Apply suggestions from code review

Co-authored-by: Paul Higinbotham <paulhi@microsoft.com>
This commit is contained in:
Vivian Thiebaut 2022-11-16 10:30:21 -05:00 committed by GitHub
parent 806eb63576
commit f574496b3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -152,7 +152,7 @@ Describe "E2E scenarios for ssh client" -Tags "CI" {
} }
It "$tC.$tI - multiple double quotes in cmdline" { It "$tC.$tI - multiple double quotes in cmdline" {
# actual command line ssh target \"cmd\" /c \"echo hello\" # actual command line ssh target "cmd" /c "echo hello"
$o = ssh test_target `"cmd`" /c `"echo hello`" $o = ssh test_target `"cmd`" /c `"echo hello`"
$o | Should Be "hello" $o | Should Be "hello"
} }
@ -223,14 +223,14 @@ Describe "E2E scenarios for ssh client" -Tags "CI" {
$o | Should Be "hello" $o | Should Be "hello"
} }
It "$tC.$tI - multiple commands with double quotes in powershell cmdlet" -skip:$skip { It "$tC.$tI - multiple commands with double quotes in powershell cmdlet" -skip:$skip {
# actual command line ssh target cd "$env:programfiles";pwd # actual command line ssh target cd "$env:programfiles\";pwd
$o = ssh test_target "cd `"`$env:programfiles\`";pwd" $o = ssh test_target "cd `"`$env:programfiles\`";pwd"
$LASTEXITCODE | Should Be 0 $LASTEXITCODE | Should Be 0
$match = $o -match "Program Files" $match = $o -match "Program Files"
$match.count | Should be 1 $match.count | Should be 1
} }
It "$tC.$tI - multiple commands with double quotes in powershell cmdlet" -skip:$skip { It "$tC.$tI - multiple commands with double quotes in powershell cmdlet" -skip:$skip {
# actual command line ssh target dir "$env:programfiles";cd "$env:programfiles";pwd # actual command line ssh target dir "$env:programfiles\";cd "$env:programfiles\";pwd
$o = ssh test_target "dir `"`$env:programfiles\`";cd `"`$env:programfiles\`";pwd" $o = ssh test_target "dir `"`$env:programfiles\`";cd `"`$env:programfiles\`";pwd"
$LASTEXITCODE | Should Be 0 $LASTEXITCODE | Should Be 0
#$o -contains "Program Files" | Shosshuld Be $True #$o -contains "Program Files" | Shosshuld Be $True
@ -262,7 +262,7 @@ Describe "E2E scenarios for ssh client" -Tags "CI" {
$o | Should Contain "cmd" $o | Should Contain "cmd"
} }
It "$tC.$tI - cmd as default shell and double quotes in cmdline" { It "$tC.$tI - cmd as default shell and double quotes in cmdline" {
# actual command line ssh target echo "\"hello\"" # actual command line ssh target echo "hello"
$o = ssh test_target echo "`"hello`"" $o = ssh test_target echo "`"hello`""
$o | Should Be "`"hello`"" $o | Should Be "`"hello`""
} }
@ -285,7 +285,7 @@ Describe "E2E scenarios for ssh client" -Tags "CI" {
Remove-ItemProperty -Path $dfltShellRegPath -Name $dfltShellCmdOptionRegKeyName -ErrorAction SilentlyContinue Remove-ItemProperty -Path $dfltShellRegPath -Name $dfltShellCmdOptionRegKeyName -ErrorAction SilentlyContinue
} }
It "$tC.$tI - shellhost as default shell and multiple double quotes in cmdline" { It "$tC.$tI - shellhost as default shell and multiple double quotes in cmdline" {
# actual command line ssh target \"cmd\" /c \"echo \"hello\"\" # actual command line ssh target "cmd" /c "echo "hello""
$o = ssh test_target `"cmd`" /c `"echo `"hello`"`" $o = ssh test_target `"cmd`" /c `"echo `"hello`"`"
$o | Should Be "`"hello`"" $o | Should Be "`"hello`""
} }