mirror of
https://github.com/neovim/neovim
synced 2025-07-16 01:01:49 +00:00
test: fix/speedup scrollback_spec
- fix: Use "set PROMPT=$" trick to satisfy screen:expect{any='%$'} - speedup: Use cmd.exe instead of powershell.
This commit is contained in:
committed by
Justin M. Keyes
parent
a7b17d4b3e
commit
db6521a560
@ -396,15 +396,14 @@ describe("'scrollback' option", function()
|
||||
it('set to 0 behaves as 1', function()
|
||||
local screen
|
||||
if iswin() then
|
||||
screen = thelpers.screen_setup(nil,
|
||||
"['powershell.exe', '-NoLogo', '-NoProfile', '-NoExit', '-Command', 'function global:prompt {return "..'"$"'.."}']", 30)
|
||||
screen = thelpers.screen_setup(nil, "['cmd.exe']", 30)
|
||||
else
|
||||
screen = thelpers.screen_setup(nil, "['sh']", 30)
|
||||
end
|
||||
|
||||
curbufmeths.set_option('scrollback', 0)
|
||||
if iswin() then
|
||||
feed_data('for($i=1;$i -le 30;$i++){Write-Host \"line$i\"}\r')
|
||||
feed_data('for /L %I in (1,1,30) do @(echo line%I)\r')
|
||||
else
|
||||
feed_data('for i in $(seq 1 30); do echo "line$i"; done\n')
|
||||
end
|
||||
@ -417,8 +416,8 @@ describe("'scrollback' option", function()
|
||||
it('deletes lines (only) if necessary', function()
|
||||
local screen
|
||||
if iswin() then
|
||||
screen = thelpers.screen_setup(nil,
|
||||
"['powershell.exe', '-NoLogo', '-NoProfile', '-NoExit', '-Command', 'function global:prompt {return "..'"$"'.."}']", 30)
|
||||
command([[let $PROMPT='$$']])
|
||||
screen = thelpers.screen_setup(nil, "['cmd.exe']", 30)
|
||||
else
|
||||
screen = thelpers.screen_setup(nil, "['sh']", 30)
|
||||
end
|
||||
@ -429,7 +428,7 @@ describe("'scrollback' option", function()
|
||||
screen:expect{any='%$'}
|
||||
|
||||
if iswin() then
|
||||
feed_data('for($i=1;$i -le 30;$i++){Write-Host \"line$i\"}\r')
|
||||
feed_data('for /L %I in (1,1,30) do @(echo line%I)\r')
|
||||
else
|
||||
feed_data('for i in $(seq 1 30); do echo "line$i"; done\n')
|
||||
end
|
||||
@ -446,7 +445,7 @@ describe("'scrollback' option", function()
|
||||
-- 'scrollback' option is synchronized with the internal sb_buffer.
|
||||
command('sleep 100m')
|
||||
if iswin() then
|
||||
feed_data('for($i=1;$i -le 40;$i++){Write-Host \"line$i\"}\r')
|
||||
feed_data('for /L %I in (1,1,40) do @(echo line%I)\r')
|
||||
else
|
||||
feed_data('for i in $(seq 1 40); do echo "line$i"; done\n')
|
||||
end
|
||||
@ -455,8 +454,8 @@ describe("'scrollback' option", function()
|
||||
|
||||
retry(nil, nil, function() expect_lines(58) end)
|
||||
-- Verify off-screen state
|
||||
eq('line35', eval("getline(line('w0') - 1)"))
|
||||
eq('line26', eval("getline(line('w0') - 10)"))
|
||||
eq((iswin() and 'line36' or 'line35'), eval("getline(line('w0') - 1)"))
|
||||
eq((iswin() and 'line27' or 'line26'), eval("getline(line('w0') - 10)"))
|
||||
|
||||
screen:detach()
|
||||
end)
|
||||
|
Reference in New Issue
Block a user