From 95b1191505a567fd309c16615948479456826c92 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 17 Jul 2022 11:57:42 +0800 Subject: vim-patch:8.2.0698: insert mode completion not fully tested Problem: Insert mode completion not fully tested. Solution: Add a few more tests. (Yegappan Lakshmanan, closes vim/vim#6041) https://github.com/vim/vim/commit/f9ab52e155dc13f59b654d754041fe78e17b9074 Cherry-pick test_ins_complete.vim changes from patches 8.2.{0522,0615}. --- src/nvim/testdir/test_textformat.vim | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/nvim/testdir/test_textformat.vim') diff --git a/src/nvim/testdir/test_textformat.vim b/src/nvim/testdir/test_textformat.vim index 35a7887761..970f5ae0d0 100644 --- a/src/nvim/testdir/test_textformat.vim +++ b/src/nvim/testdir/test_textformat.vim @@ -1161,6 +1161,30 @@ func Test_whichwrap_multi_byte() bwipe! endfunc +" Test for automatically adding comment leaders in insert mode +func Test_threepiece_comment() + new + setlocal expandtab + call setline(1, ["\t/*"]) + setlocal formatoptions=croql + call cursor(1, 3) + call feedkeys("A\\/", 'tnix') + call assert_equal(["\t/*", " *", " */"], getline(1, '$')) + + " If a comment ends in a single line, then don't add it in the next line + %d + call setline(1, '/* line1 */') + call feedkeys("A\next line", 'xt') + call assert_equal(['/* line1 */', 'next line'], getline(1, '$')) + + %d + " Copy the trailing indentation from the leader comment to a new line + setlocal autoindent noexpandtab + call feedkeys("a\t/*\tone\ntwo\n/", 'xt') + call assert_equal(["\t/*\tone", "\t *\ttwo", "\t */"], getline(1, '$')) + close! +endfunc + " Test for the 'f' flag in 'comments' (only the first line has the comment " string) func Test_firstline_comment() -- cgit