Add find.exe to legacy argument binding behavior for Windows (#17715)

This commit is contained in:
James Truher [MSFT]
2022-07-20 14:47:50 -07:00
committed by GitHub
parent 42d0e99286
commit 031fa93b4c
2 changed files with 20 additions and 0 deletions
@@ -171,6 +171,25 @@ Describe "Will error correctly if an attempt to set variable to improper value"
}
}
Describe "find.exe uses legacy behavior on Windows" {
BeforeAll {
$currentSetting = $PSNativeCommandArgumentPassing
$PSNativeCommandArgumentPassing = "Windows"
$testCases = @{ pattern = "" },
@{ pattern = "blat" },
@{ pattern = "bl at" }
}
AfterAll {
$PSNativeCommandArgumentPassing = $currentSetting
}
It "The pattern '<pattern>' is used properly by find.exe" -skip:(! $IsWindows) -testCases $testCases {
param ($pattern)
$expr = "'foo' | find.exe --% /v ""$pattern"""
$result = Invoke-Expression $expr
$result | Should -Be 'foo'
}
}
foreach ( $argumentListValue in "Standard","Legacy","Windows" ) {
$PSNativeCommandArgumentPassing = $argumentListValue
Describe "Native Command Arguments (${PSNativeCommandArgumentPassing})" -tags "CI" {