Correct case of $MyInvocation special variable

This commit is contained in:
xtqqczze
2020-01-13 19:04:32 +00:00
parent 4f5bb46268
commit d58e1ff13b
3 changed files with 7 additions and 7 deletions
@@ -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'
}
@@ -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
@@ -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)"
}
}