Files
PowerShell/test/powershell/Scripting/NativeExecution/NativeCommandArguments.Tests.ps1
T
Douglas Thrift 4d5d0a0034 Rename Publish-EchoArgs to Publish-PSTestTools
* Rename Publish-EchoArgs to Publish-PSTestTools so it can be used
  for other tools as well in the future
* Publish EchoArgs to the bin directory instead of run to match
  convention
* Add source URL to EchoArgs header comment
* Use wildcard of "*.nuget.props" to match
  "test/csharp/csharp.nuget.props" in .gitignore
2016-09-13 13:37:42 -07:00

23 lines
869 B
PowerShell

Describe "Native Command Arguments" -tags "CI" {
$testPath = 'TestDrive:\test.txt'
$powershellTestDir = $PSScriptRoot
while ($powershellTestDir -notmatch 'test[\\/]powershell$') {
$powershellTestDir = Split-Path $powershellTestDir
}
$echoArgs = Join-Path (Split-Path $powershellTestDir) tools/EchoArgs/bin/echoargs
It "Should handle quoted spaces correctly" {
$a = 'a"b c"d'
& $echoArgs $a 'a"b c"d' a"b c"d >$testPath
$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" {
& $echoArgs 'a\"b c\"d' "a\`"b c\`"d" >$testPath
$testPath | Should Contain 'Arg 0 is <a"b c"d>'
$testPath | Should Contain 'Arg 1 is <a"b c"d>'
}
}