2016-09-11 21:13:14 -07:00
|
|
|
Describe "Native Command Arguments" -tags "CI" {
|
|
|
|
|
$testPath = 'TestDrive:\test.txt'
|
|
|
|
|
$powershellTestDir = $PSScriptRoot
|
|
|
|
|
while ($powershellTestDir -notmatch 'test[\\/]powershell$') {
|
|
|
|
|
$powershellTestDir = Split-Path $powershellTestDir
|
|
|
|
|
}
|
2016-09-12 10:39:42 -07:00
|
|
|
$echoArgs = Join-Path (Split-Path $powershellTestDir) tools/EchoArgs/bin/echoargs
|
2016-09-11 21:13:14 -07:00
|
|
|
|
|
|
|
|
It "Should handle quoted spaces correctly" {
|
|
|
|
|
$a = 'a"b c"d'
|
2016-09-11 23:14:30 -07:00
|
|
|
& $echoArgs $a 'a"b c"d' a"b c"d >$testPath
|
2016-09-11 21:13:14 -07:00
|
|
|
$testPath | Should Contain 'Arg 0 is <ab cd>'
|
|
|
|
|
$testPath | Should Contain 'Arg 1 is <ab cd>'
|
|
|
|
|
$testPath | Should Contain 'Arg 2 is <ab cd>'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
It "Should handle spaces between escaped quotes" {
|
2016-09-11 23:14:30 -07:00
|
|
|
& $echoArgs 'a\"b c\"d' "a\`"b c\`"d" >$testPath
|
2016-09-11 21:13:14 -07:00
|
|
|
$testPath | Should Contain 'Arg 0 is <a"b c"d>'
|
|
|
|
|
$testPath | Should Contain 'Arg 1 is <a"b c"d>'
|
|
|
|
|
}
|
|
|
|
|
}
|