aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/functional/ui/inccommand_spec.lua18
1 files changed, 13 insertions, 5 deletions
diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua
index 4a8ebf6212..74ab9864f0 100644
--- a/test/functional/ui/inccommand_spec.lua
+++ b/test/functional/ui/inccommand_spec.lua
@@ -12,6 +12,7 @@ local insert = helpers.insert
local meths = helpers.meths
local neq = helpers.neq
local ok = helpers.ok
+local retry = helpers.retry
local source = helpers.source
local wait = helpers.wait
local nvim = helpers.nvim
@@ -91,22 +92,30 @@ local function common_setup(screen, inccommand, text)
end
end
-describe(":substitute, inccommand=split does not trigger preview", function()
+describe(":substitute, inccommand=split", function()
before_each(function()
clear()
common_setup(nil, "split", default_text)
end)
- it("if invoked by a script ", function()
+ -- Test the tests: verify that the `1==bufnr('$')` assertion
+ -- in the "no preview" tests (below) actually means something.
+ it("previews interactive cmdline", function()
+ feed(':%s/tw/MO/g')
+ retry(nil, 1000, function()
+ eq(2, eval("bufnr('$')"))
+ end)
+ end)
+
+ it("no preview if invoked by a script", function()
source('%s/tw/MO/g')
wait()
eq(1, eval("bufnr('$')"))
-
-- sanity check: assert the buffer state
expect(default_text:gsub("tw", "MO"))
end)
- it("if invoked by feedkeys()", function()
+ it("no preview if invoked by feedkeys()", function()
-- in a script...
source([[:call feedkeys(":%s/tw/MO/g\<CR>")]])
wait()
@@ -114,7 +123,6 @@ describe(":substitute, inccommand=split does not trigger preview", function()
feed([[:call feedkeys(":%s/tw/MO/g\<CR>")<CR>]])
wait()
eq(1, eval("bufnr('$')"))
-
-- sanity check: assert the buffer state
expect(default_text:gsub("tw", "MO"))
end)