diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2017-03-11 14:46:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-11 14:46:35 +0100 |
commit | fd27d5a70f5bd606c52b0119ed3677356c7891ce (patch) | |
tree | 47e9d9941a50938ef87455ac10560c46beee78ab /test/functional/terminal/scrollback_spec.lua | |
parent | c5edde90cc9684946e40f670af9ea60165d30bac (diff) | |
download | rneovim-fd27d5a70f5bd606c52b0119ed3677356c7891ce.tar.gz rneovim-fd27d5a70f5bd606c52b0119ed3677356c7891ce.tar.bz2 rneovim-fd27d5a70f5bd606c52b0119ed3677356c7891ce.zip |
test/scrollback: wiggle-room (#6256)
Diffstat (limited to 'test/functional/terminal/scrollback_spec.lua')
-rw-r--r-- | test/functional/terminal/scrollback_spec.lua | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/test/functional/terminal/scrollback_spec.lua b/test/functional/terminal/scrollback_spec.lua index 930d0cf58b..81649f2bde 100644 --- a/test/functional/terminal/scrollback_spec.lua +++ b/test/functional/terminal/scrollback_spec.lua @@ -368,10 +368,11 @@ describe("'scrollback' option", function() clear() end) - local function expect_lines(expected) + local function expect_lines(expected, epsilon) + local ep = epsilon and epsilon or 0 local actual = eval("line('$')") - if expected ~= actual then - error('expected: '..expected..', actual: '..tostring(actual)) + if expected > actual + ep and expected < actual - ep then + error('expected (+/- '..ep..'): '..expected..', actual: '..tostring(actual)) end end @@ -399,12 +400,12 @@ describe("'scrollback' option", function() 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) wait() retry(nil, nil, function() expect_lines(16) end) 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 -- 'scrollback' option is synchronized with the internal sb_buffer. command('sleep 100m') |