@@ -27,9 +27,8 @@ Describe "E2E scenarios for ssh client" -Tags "CI" {
2727 $accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule($ssouser , $rights , " ContainerInherit,Objectinherit" , " None" , " Allow" )
2828 $acl.SetAccessRule ($accessRule )
2929 Set-Acl - Path $testDir - AclObject $acl
30- $platform = Get-Platform
3130 # skip on ps 2 becase non-interactive cmd require a ENTER before it returns on ps2
32- $skip = ( $platform -eq [ PlatformType ]::Windows) -and ($PSVersionTable.PSVersion.Major -le 2 )
31+ $skip = $IsWindows -and ($PSVersionTable.PSVersion.Major -le 2 )
3332
3433 <# $testData = @(
3534 @{
@@ -153,8 +152,8 @@ Describe "E2E scenarios for ssh client" -Tags "CI" {
153152 }
154153
155154 It " $tC .$tI - multiple double quotes in cmdline" {
156- # actual command line ssh target \ "cmd\ " /c \ "echo hello\ "
157- $o = ssh test_target ` \ ` " cmd` \ ` " / c ` \ ` " echo hello` \ `"
155+ # actual command line ssh target "cmd" /c "echo hello"
156+ $o = ssh test_target `" cmd`" / c `" echo hello`"
158157 $o | Should Be " hello"
159158 }
160159
@@ -220,19 +219,19 @@ Describe "E2E scenarios for ssh client" -Tags "CI" {
220219 }
221220 It " $tC .$tI - powershell as default shell and double quotes in cmdline" {
222221 # actual command line ssh target echo `"hello`"
223- $o = ssh test_target echo `` \ ` " hello`` \ `"
224- $o | Should Be " `" hello`" "
222+ $o = ssh test_target echo `" hello`"
223+ $o | Should Be " hello"
225224 }
226225 It " $tC .$tI - multiple commands with double quotes in powershell cmdlet" - skip:$skip {
227- # actual command line ssh target cd "$env:programfiles";pwd
228- $o = ssh test_target " cd \ `"`$ env:programfiles\`" ;pwd"
226+ # actual command line ssh target cd "$env:programfiles\ ";pwd
227+ $o = ssh test_target " cd `"`$ env:programfiles\`" ;pwd"
229228 $LASTEXITCODE | Should Be 0
230229 $match = $o -match " Program Files"
231230 $match.count | Should be 1
232231 }
233232 It " $tC .$tI - multiple commands with double quotes in powershell cmdlet" - skip:$skip {
234- # actual command line ssh target dir "$env:programfiles";cd "$env:programfiles";pwd
235- $o = ssh test_target " dir \ `"`$ env:programfiles\`" ;cd \ `"`$ env:programfiles\`" ;pwd"
233+ # actual command line ssh target dir "$env:programfiles\ ";cd "$env:programfiles\ ";pwd
234+ $o = ssh test_target " dir `"`$ env:programfiles\`" ;cd `"`$ env:programfiles\`" ;pwd"
236235 $LASTEXITCODE | Should Be 0
237236 # $o -contains "Program Files" | Should Be $True
238237 $match = $o -match " Program Files"
@@ -263,8 +262,8 @@ Describe "E2E scenarios for ssh client" -Tags "CI" {
263262 $o | Should Contain " cmd"
264263 }
265264 It " $tC .$tI - cmd as default shell and double quotes in cmdline" {
266- # actual command line ssh target echo "\" hello\" "
267- $o = ssh test_target ' echo "\ "hello\"" '
265+ # actual command line ssh target echo "hello"
266+ $o = ssh test_target echo " ` " hello`" "
268267 $o | Should Be " `" hello`" "
269268 }
270269 It " $tC .$tI - single quotes in powershell cmdlet" - skip:$skip {
@@ -286,8 +285,8 @@ Describe "E2E scenarios for ssh client" -Tags "CI" {
286285 Remove-ItemProperty - Path $dfltShellRegPath - Name $dfltShellCmdOptionRegKeyName - ErrorAction SilentlyContinue
287286 }
288287 It " $tC .$tI - shellhost as default shell and multiple double quotes in cmdline" {
289- # actual command line ssh target \ "cmd\ " /c \ "echo \ "hello\"\ "
290- $o = ssh test_target ` \ ` " cmd` \ ` " / c ` \ ` " echo \ `" hello\ `" ` \ `"
288+ # actual command line ssh target "cmd" /c "echo "hello" "
289+ $o = ssh test_target `" cmd`" / c `" echo `" hello`" `"
291290 $o | Should Be " `" hello`" "
292291 }
293292 }
0 commit comments