aboutsummaryrefslogtreecommitdiffstats
path: root/tests/indent/common.lua
diff options
context:
space:
mode:
authorStephan Seitz <stephan.seitz@fau.de>2022-02-05 19:51:50 +0100
committerStephan Seitz <stephan.seitz@fau.de>2022-02-06 19:42:57 +0100
commitfc54020531927fd41018d0092d58d3b02674f441 (patch)
tree7b4f011f92eb67336d1c2f64b241258417c32298 /tests/indent/common.lua
parenttests: add test for #2086 (diff)
downloadnvim-treesitter-fc54020531927fd41018d0092d58d3b02674f441.tar
nvim-treesitter-fc54020531927fd41018d0092d58d3b02674f441.tar.gz
nvim-treesitter-fc54020531927fd41018d0092d58d3b02674f441.tar.bz2
nvim-treesitter-fc54020531927fd41018d0092d58d3b02674f441.tar.lz
nvim-treesitter-fc54020531927fd41018d0092d58d3b02674f441.tar.xz
nvim-treesitter-fc54020531927fd41018d0092d58d3b02674f441.tar.zst
nvim-treesitter-fc54020531927fd41018d0092d58d3b02674f441.zip
tests(indent): also test creating new line when still in insert mode
Diffstat (limited to 'tests/indent/common.lua')
-rw-r--r--tests/indent/common.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/indent/common.lua b/tests/indent/common.lua
index c9f91214e..451d2f626 100644
--- a/tests/indent/common.lua
+++ b/tests/indent/common.lua
@@ -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 = {}