mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 04:17:01 +00:00
test/scrollback: wiggle-room (#6256)
This commit is contained in:
@@ -368,10 +368,11 @@ describe("'scrollback' option", function()
|
|||||||
clear()
|
clear()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local function expect_lines(expected)
|
local function expect_lines(expected, epsilon)
|
||||||
|
local ep = epsilon and epsilon or 0
|
||||||
local actual = eval("line('$')")
|
local actual = eval("line('$')")
|
||||||
if expected ~= actual then
|
if expected > actual + ep and expected < actual - ep then
|
||||||
error('expected: '..expected..', actual: '..tostring(actual))
|
error('expected (+/- '..ep..'): '..expected..', actual: '..tostring(actual))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -399,12 +400,12 @@ describe("'scrollback' option", function()
|
|||||||
|
|
||||||
screen:expect('line30 ', nil, nil, nil, true)
|
screen:expect('line30 ', nil, nil, nil, true)
|
||||||
|
|
||||||
retry(nil, nil, function() expect_lines(33) end)
|
retry(nil, nil, function() expect_lines(33, 2) end)
|
||||||
curbufmeths.set_option('scrollback', 10)
|
curbufmeths.set_option('scrollback', 10)
|
||||||
wait()
|
wait()
|
||||||
retry(nil, nil, function() expect_lines(16) end)
|
retry(nil, nil, function() expect_lines(16) end)
|
||||||
curbufmeths.set_option('scrollback', 10000)
|
curbufmeths.set_option('scrollback', 10000)
|
||||||
eq(16, eval("line('$')"))
|
retry(nil, nil, function() expect_lines(16) end)
|
||||||
-- 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')
|
||||||
|
|||||||
Reference in New Issue
Block a user