From 4b2d7bb5eafde6edbbd55b563e8f73dba4165853 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 16 Sep 2019 19:17:07 +0200 Subject: tests: fix flaky 'scrollback' option deletes lines (only) if necessary (#11003) Using `screen:expect` with the complete grid appears to fix its flakiness. Fixes https://github.com/neovim/neovim/issues/10723. --- test/functional/terminal/scrollback_spec.lua | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/test/functional/terminal/scrollback_spec.lua b/test/functional/terminal/scrollback_spec.lua index 7413081510..ff6a74fe89 100644 --- a/test/functional/terminal/scrollback_spec.lua +++ b/test/functional/terminal/scrollback_spec.lua @@ -438,9 +438,29 @@ describe("'scrollback' option", function() command('sleep 100m') feed_data(nvim_dir.."/shell-test REP 41 line"..(iswin() and '\r' or '\n')) - screen:expect{any='40: line '} + if iswin() then + screen:expect{grid=[[ + 37: line | + 38: line | + 39: line | + 40: line | + | + ${1: } | + {3:-- TERMINAL --} | + ]]} + else + screen:expect{grid=[[ + 36: line | + 37: line | + 38: line | + 39: line | + 40: line | + {IGNORE}| + {3:-- TERMINAL --} | + ]]} + end + expect_lines(58) - retry(nil, nil, function() expect_lines(58) end) -- Verify off-screen state eq((iswin() and '36: line' or '35: line'), eval("getline(line('w0') - 1)")) eq((iswin() and '27: line' or '26: line'), eval("getline(line('w0') - 10)")) -- cgit