test/inccommand_spec: test the test (#7897)

This commit is contained in:
Justin M. Keyes
2018-01-23 00:53:22 +01:00
committed by GitHub
parent 3308b76339
commit 7dd97eb597

View File

@@ -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)