test: rewrite powershell tests to remove timeout

TSAN kept failing and Appveyor sometimes fails on the same test.
This commit is contained in:
Jan Edmund Lazo
2020-11-19 23:12:01 -05:00
parent 0c86e70bf0
commit 172d5b6561

View File

@@ -232,20 +232,53 @@ describe("shell command :!", function()
if has_powershell() then if has_powershell() then
it('powershell supports literal strings', function() it('powershell supports literal strings', function()
set_shell_powershell() set_shell_powershell()
local screen = Screen.new(30, 4) local screen = Screen.new(45, 4)
screen:attach() screen:attach()
feed_command([[!'Write-Output $a']]) feed_command([[!'Write-Output $a']])
screen:expect{any='\nWrite%-Output %$a', timeout=10000} screen:expect([[
:!'Write-Output $a' |
Write-Output $a |
|
Press ENTER or type command to continue^ |
]])
feed_command([[!$a = 1; Write-Output '$a']]) feed_command([[!$a = 1; Write-Output '$a']])
screen:expect{any='\n%$a', timeout=10000} screen:expect([[
:!$a = 1; Write-Output '$a' |
$a |
|
Press ENTER or type command to continue^ |
]])
feed_command([[!"Write-Output $a"]]) feed_command([[!"Write-Output $a"]])
screen:expect{any='\nWrite%-Output', timeout=10000} screen:expect([[
:!"Write-Output $a" |
Write-Output |
|
Press ENTER or type command to continue^ |
]])
feed_command([[!$a = 1; Write-Output "$a"]]) feed_command([[!$a = 1; Write-Output "$a"]])
screen:expect{any='\n1', timeout=10000} screen:expect([[
feed_command(iswin() :!$a = 1; Write-Output "$a" |
and [[!& 'C:\\Windows\\system32\\cmd.exe' /c 'echo $a']] 1 |
or [[!& '/bin/sh' -c 'echo ''$a''']]) |
screen:expect{any='\n%$a', timeout=10000} Press ENTER or type command to continue^ |
]])
if iswin() then
feed_command([[!& 'cmd.exe' /c 'echo $a']])
screen:expect([[
:!& 'cmd.exe' /c 'echo $a' |
$a |
|
Press ENTER or type command to continue^ |
]])
else
feed_command([[!& '/bin/sh' -c 'echo ''$a''']])
screen:expect([[
:!& '/bin/sh' -c 'echo ''$a''' |
$a |
|
Press ENTER or type command to continue^ |
]])
end
end) end)
end end
end) end)