From d58e1ff13b2d470b6d812d9f57d561c96afb1056 Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Mon, 13 Jan 2020 19:04:32 +0000 Subject: [PATCH] Correct case of $MyInvocation special variable --- .../Parser/LanguageAndParser.TestFollowup.Tests.ps1 | 2 +- test/powershell/Language/Scripting/Delegates.Tests.ps1 | 2 +- .../Implicit.Remoting.Tests.ps1 | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/powershell/Language/Parser/LanguageAndParser.TestFollowup.Tests.ps1 b/test/powershell/Language/Parser/LanguageAndParser.TestFollowup.Tests.ps1 index 4095477871..949cc6a15a 100644 --- a/test/powershell/Language/Parser/LanguageAndParser.TestFollowup.Tests.ps1 +++ b/test/powershell/Language/Parser/LanguageAndParser.TestFollowup.Tests.ps1 @@ -137,7 +137,7 @@ Describe "Assign automatic variables" -Tags "CI" { & { [object]$this = 1; $this } | Should -Be 1 & { [object]$input = 1; $input } | Should -Be 1 # Can't test PSCmdlet or PSBoundParameters, they use an internal type - & { [System.Management.Automation.InvocationInfo]$myInvocation = $myInvocation; $myInvocation.Line } | Should -Match Automation.InvocationInfo + & { [System.Management.Automation.InvocationInfo]$MyInvocation = $MyInvocation; $MyInvocation.Line } | Should -Match Automation.InvocationInfo & { [string]$PSScriptRoot = 'abc'; $PSScriptRoot } | Should -BeExactly 'abc' & { [string]$PSCommandPath = 'abc'; $PSCommandPath } | Should -BeExactly 'abc' } diff --git a/test/powershell/Language/Scripting/Delegates.Tests.ps1 b/test/powershell/Language/Scripting/Delegates.Tests.ps1 index 1b3b2e6e4c..6f3919dde9 100644 --- a/test/powershell/Language/Scripting/Delegates.Tests.ps1 +++ b/test/powershell/Language/Scripting/Delegates.Tests.ps1 @@ -4,7 +4,7 @@ Describe 'Test for conversion b/w script block and delegate' -Tags "CI" { BeforeAll { function lineno { - $myInvocation.ScriptLineNumber + $MyInvocation.ScriptLineNumber } function Generate-ArgumentTypesAndParameters diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/Implicit.Remoting.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/Implicit.Remoting.Tests.ps1 index 620ee95dde..3280b11936 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/Implicit.Remoting.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/Implicit.Remoting.Tests.ps1 @@ -857,7 +857,7 @@ try $ipaddress ) - "Bound parameter: $($myInvocation.BoundParameters.Keys | Sort-Object)" + "Bound parameter: $($MyInvocation.BoundParameters.Keys | Sort-Object)" } } @@ -898,7 +898,7 @@ try $ipaddress ) - "Bound parameter: $($myInvocation.BoundParameters.Keys)" + "Bound parameter: $($MyInvocation.BoundParameters.Keys)" } } @@ -939,7 +939,7 @@ try $ipaddress ) - "Bound parameter: $($myInvocation.BoundParameters.Keys | Sort-Object)" + "Bound parameter: $($MyInvocation.BoundParameters.Keys | Sort-Object)" } } @@ -990,7 +990,7 @@ try $PriorityClass ) - "Bound parameter: $($myInvocation.BoundParameters.Keys | Sort-Object)" + "Bound parameter: $($MyInvocation.BoundParameters.Keys | Sort-Object)" } } @@ -1036,7 +1036,7 @@ try $ipaddress ) - "Bound parameter: $($myInvocation.BoundParameters.Keys | Sort-Object)" + "Bound parameter: $($MyInvocation.BoundParameters.Keys | Sort-Object)" } }