tests(indent): also test creating new line when still in insert mode

This commit is contained in:
Stephan Seitz 2022-02-05 19:51:50 +01:00
parent 9940e48675
commit fc54020531

View file

@ -140,6 +140,17 @@ function M.indent_new_line(file, spec, opts, xfail)
table.insert(before, spec.on_line + 1, indent .. spec.text)
compare_indent(before, after, xfail)
before, after = M.run_indent_test(file, function()
-- move to the line and input the new one
vim.cmd(string.format("normal! %dG$", spec.on_line))
vim.cmd(string.format(vim.api.nvim_replace_termcodes("normal! a<cr>%s", true, true, true), spec.text))
end, opts)
indent = type(spec.indent) == "string" and spec.indent or string.rep(" ", spec.indent)
table.insert(before, spec.on_line + 1, indent .. spec.text)
compare_indent(before, after, xfail)
end
local Runner = {}