From 48f0542ad6f923443ab4bba858aae2d9558f8d76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Linse?= Date: Fri, 21 Apr 2017 10:59:06 +0200 Subject: [PATCH] tests: detect invalid helpers.sleep --- test/functional/ex_cmds/ctrl_c_spec.lua | 2 +- test/functional/helpers.lua | 11 ++++++++++- 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") - helpers.sleep(ms) + screen:sleep(ms) feed("") 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([[]]) wait() - screen.sleep(10) -- Let some terminal activity happen. + screen:sleep(10) -- Let some terminal activity happen. feed_command("messages") screen:expect([[ msg1 |