Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -565,21 +565,15 @@ private void Process_Types_Ps1Xml(string filePath, ConcurrentBag<string> errors)
typeName,
new PSScriptProperty(
@"DisplayName",
GetScriptBlock(@"if ($this.Name.IndexOf('-') -lt 0)
{
if ($null -ne $this.ResolvedCommand)
GetScriptBlock(@"if ($null -ne $this.ResolvedCommand)
Comment thread
kilasuit marked this conversation as resolved.
{
$this.Name + "" -> "" + $this.ResolvedCommand.Name
}
else
{
$this.Name + "" -> "" + $this.Definition
}
}
else
{
$this.Name
}"),
"),
setterScript: null,
shouldCloneOnAccess: true),
typeMembers,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,16 @@ Describe "Get-Alias DRT Unit Tests" -Tags "CI" {
$returnObject[$i].Definition | Should -Be 'Get-Command'
}
}

It "Get-Alias DisplayName should always show AliasName -> ResolvedCommand for all aliases" {
Set-Alias -Name Test-MyAlias -Value Get-Command -Force
Set-Alias -Name tma -Value Test-MyAlias -force
Comment thread
kilasuit marked this conversation as resolved.
$aliases = Get-Alias Test-MyAlias, tma
$aliases | ForEach-Object {
$_.DisplayName | Should -Be "$($_.Name) -> Get-Command"
}
$aliases.Name.foreach{Remove-Item Alias:$_ -ErrorAction SilentlyContinue}
}
}

Describe "Get-Alias" -Tags "CI" {
Expand Down
Loading