tests: scrollback_spec: use shell-test instead of awk (#10914)

Ref: #10804
Ref: b64af88
This commit is contained in:
Daniel Hahler 2019-09-04 20:01:38 +02:00 committed by GitHub
parent bd1158f3ab
commit d7aea13fee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -403,12 +403,8 @@ describe("'scrollback' option", function()
end end
curbufmeths.set_option('scrollback', 0) curbufmeths.set_option('scrollback', 0)
if iswin() then feed_data(nvim_dir..'/shell-test REP 31 line'..(iswin() and '\r' or '\n'))
feed_data('for /L %I in (1,1,30) do @(echo line%I)\r') screen:expect{any='30: line '}
else
feed_data('awk "BEGIN{for(n=1;n<=30;n++) print \\\"line\\\" n}"\n')
end
screen:expect{any='line30 '}
retry(nil, nil, function() expect_lines(7) end) retry(nil, nil, function() expect_lines(7) end)
screen:detach() screen:detach()
@ -428,13 +424,8 @@ describe("'scrollback' option", function()
-- Wait for prompt. -- Wait for prompt.
screen:expect{any='%$'} screen:expect{any='%$'}
if iswin() then feed_data(nvim_dir.."/shell-test REP 31 line"..(iswin() and '\r' or '\n'))
feed_data('for /L %I in (1,1,30) do @(echo line%I)\r') screen:expect{any='30: line '}
else
feed_data('awk "BEGIN{for(n=1;n<=30;n++) print \\\"line\\\" n}"\n')
end
screen:expect{any='line30 '}
retry(nil, nil, function() expect_lines(33, 2) end) retry(nil, nil, function() expect_lines(33, 2) end)
curbufmeths.set_option('scrollback', 10) curbufmeths.set_option('scrollback', 10)
@ -445,18 +436,14 @@ describe("'scrollback' option", function()
-- Terminal job data is received asynchronously, may happen before the -- Terminal job data is received asynchronously, may happen before the
-- 'scrollback' option is synchronized with the internal sb_buffer. -- 'scrollback' option is synchronized with the internal sb_buffer.
command('sleep 100m') command('sleep 100m')
if iswin() then
feed_data('for /L %I in (1,1,40) do @(echo line%I)\r')
else
feed_data('awk "BEGIN{for(n=1;n<=40;n++) print \\\"line\\\" n}"\n')
end
screen:expect{any='line40 '} feed_data(nvim_dir.."/shell-test REP 41 line"..(iswin() and '\r' or '\n'))
screen:expect{any='40: line '}
retry(nil, nil, function() expect_lines(58) end) retry(nil, nil, function() expect_lines(58) end)
-- Verify off-screen state -- Verify off-screen state
eq((iswin() and 'line36' or 'line35'), eval("getline(line('w0') - 1)")) eq((iswin() and '36: line' or '35: line'), eval("getline(line('w0') - 1)"))
eq((iswin() and 'line27' or 'line26'), eval("getline(line('w0') - 10)")) eq((iswin() and '27: line' or '26: line'), eval("getline(line('w0') - 10)"))
screen:detach() screen:detach()
end) end)