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 @@ -6058,7 +6058,7 @@ private void Process_Types_Ps1Xml(string filePath, ConcurrentBag<string> errors)
{
if ($argumentsBuilder.Length -gt 1)
{
$argumentsBuilder.Append(string.Empty, string.Empty);
$argumentsBuilder.Append("", "");
}

$argumentsBuilder.Append($entry.Key).Append(""="")
Expand All @@ -6073,7 +6073,7 @@ private void Process_Types_Ps1Xml(string filePath, ConcurrentBag<string> errors)
{
if ($argumentsBuilder.Length -gt 1)
{
$argumentsBuilder.Append(string.Empty, string.Empty)
$argumentsBuilder.Append("", "")
}

if ($arg)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,20 @@ Describe "Get-PSCallStack DRT Unit Tests" -Tags "CI" {
$results[0].ScriptName | Should -Be $scriptFilePath
$results[0].ScriptLineNumber | Should -Be 27
$results[0].InvocationInfo.ScriptLineNumber | Should -Be 9
$results[0].Location | Should -Match $scriptFileName

$results[1].Command | Should -BeExactly "foo"
$results[1].ScriptName | Should -Be $scriptFilePath
$results[1].ScriptLineNumber | Should -Be 9
$results[1].InvocationInfo.ScriptLineNumber | Should -Be 32
$results[1].Location | Should -Match $scriptFileName

#InvocationInfo.ScriptLineNumber: Gets the line number of the script that contains the command
$results[2].Command | Should -Be $scriptFileName
$results[2].ScriptName | Should -Be $scriptFilePath
$results[2].ScriptLineNumber | Should -Be 32
$results[2].InvocationInfo.ScriptLineNumber | Should -Be 46
$results[2].Location | Should -Match $scriptFileName
}

It "Verify that the script block of a trap statement shows up on the call stack" {
Expand All @@ -79,11 +82,17 @@ Describe "Get-PSCallStack DRT Unit Tests" -Tags "CI" {
$results[0].Command | Should -Be $scriptFileName
$results[0].ScriptName | Should -Be $scriptFilePath
$results[0].ScriptLineNumber | Should -Be 3
$results[0].InvocationInfo.ScriptLineNumber | Should -Be 77
$results[0].InvocationInfo.ScriptLineNumber | Should -Be 80

$results[1].Command | Should -Be $scriptFileName
$results[1].ScriptName | Should -Be $scriptFilePath
$results[1].ScriptLineNumber | Should -Be 7
$results[1].InvocationInfo.ScriptLineNumber | Should -Be 77
$results[1].InvocationInfo.ScriptLineNumber | Should -Be 80
}

It "Get-PSCallStack returns Arguments" {
& { (Get-PSCallStack)[0].Arguments } 'foo' | Should -Match 'foo'
& { param ($x) (Get-PSCallStack)[0].Arguments } 'foo' | Should -Match 'foo'
& { (Get-PSCallStack)[0].Arguments } 'foo' 'bar' | Should -Match 'foo, bar'
}
}