diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2017-04-21 10:59:06 +0200 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2017-04-21 14:21:26 +0200 |
commit | 48f0542ad6f923443ab4bba858aae2d9558f8d76 (patch) | |
tree | 3a27c8826e6e05be56696aaae126f7940e71fa36 | |
parent | 9cc97896813fa4f40a4e37b6f72284cdb10c4195 (diff) | |
download | rneovim-48f0542ad6f923443ab4bba858aae2d9558f8d76.tar.gz rneovim-48f0542ad6f923443ab4bba858aae2d9558f8d76.tar.bz2 rneovim-48f0542ad6f923443ab4bba858aae2d9558f8d76.zip |
tests: detect invalid helpers.sleep
-rw-r--r-- | test/functional/ex_cmds/ctrl_c_spec.lua | 2 | ||||
-rw-r--r-- | test/functional/helpers.lua | 11 | ||||
-rw-r--r-- | test/functional/terminal/ex_terminal_spec.lua | 2 |
3 files changed, 12 insertions, 3 deletions
diff --git a/test/functional/ex_cmds/ctrl_c_spec.lua b/test/functional/ex_cmds/ctrl_c_spec.lua index 993bfa0dba..091a008814 100644 --- a/test/functional/ex_cmds/ctrl_c_spec.lua +++ b/test/functional/ex_cmds/ctrl_c_spec.lua @@ -41,7 +41,7 @@ describe("CTRL-C (mapped)", function() local function test_ctrl_c(ms) feed(":global/^/p<CR>") - helpers.sleep(ms) + screen:sleep(ms) feed("<C-C>") screen:expect([[Interrupt]], nil, nil, nil, true) end diff --git a/test/functional/helpers.lua b/test/functional/helpers.lua index 5882758b5a..84e81c5af4 100644 --- a/test/functional/helpers.lua +++ b/test/functional/helpers.lua @@ -392,7 +392,16 @@ end -- sleeps the test runner (_not_ the nvim instance) local function sleep(ms) - run(nil, nil, nil, ms) + local function notification_cb(method, args) + local _ = args + if method == "redraw" then + error("helpers.sleep() called while screen is attached. ".. + "Use screen:sleep(...) instead") + end + return true + end + + run(nil, notification_cb, nil, ms) end local function curbuf_contents() diff --git a/test/functional/terminal/ex_terminal_spec.lua b/test/functional/terminal/ex_terminal_spec.lua index 1ed63adcfb..be0fd9f8ff 100644 --- a/test/functional/terminal/ex_terminal_spec.lua +++ b/test/functional/terminal/ex_terminal_spec.lua @@ -26,7 +26,7 @@ describe(':terminal', function() feed_command([[terminal while true; do echo X; done]]) helpers.feed([[<C-\><C-N>]]) wait() - screen.sleep(10) -- Let some terminal activity happen. + screen:sleep(10) -- Let some terminal activity happen. feed_command("messages") screen:expect([[ msg1 | |