aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_textformat.vim
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-07-19 22:27:36 +0800
committerGitHub <noreply@github.com>2022-07-19 22:27:36 +0800
commitb154d951e6c01919278bf77a4079396c2df471f4 (patch)
tree0cbf132a7edc4dc0b3a5bab76408f35c89536af1 /src/nvim/testdir/test_textformat.vim
parent9e15bdde3ba8c84177d6d912eef3c0e056a76bb9 (diff)
parent358f9b776b48e854fdb714c76b24c5929bbd8544 (diff)
downloadrneovim-b154d951e6c01919278bf77a4079396c2df471f4.tar.gz
rneovim-b154d951e6c01919278bf77a4079396c2df471f4.tar.bz2
rneovim-b154d951e6c01919278bf77a4079396c2df471f4.zip
Merge pull request #19434 from zeertzjq/vim-8.2.0509
vim-patch:8.2.{0509,2632}: startup tests
Diffstat (limited to 'src/nvim/testdir/test_textformat.vim')
-rw-r--r--src/nvim/testdir/test_textformat.vim54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_textformat.vim b/src/nvim/testdir/test_textformat.vim
index 970f5ae0d0..1d1f20d91a 100644
--- a/src/nvim/testdir/test_textformat.vim
+++ b/src/nvim/testdir/test_textformat.vim
@@ -1260,6 +1260,41 @@ func Test_comment_nested()
%bw!
endfunc
+" Test for a space character in 'comments' setting
+func Test_comment_space()
+ new
+ setlocal comments=b:\ > fo+=ro
+ exe "normal i> B\nD\<C-C>ggOA\<C-C>joC"
+ exe "normal Go > F\nH\<C-C>kOE\<C-C>joG"
+ let expected =<< trim END
+ A
+ > B
+ C
+ D
+ > E
+ > F
+ > G
+ > H
+ END
+ call assert_equal(expected, getline(1, '$'))
+ %bw!
+endfunc
+
+" Test for the 'O' flag in 'comments'
+func Test_comment_O()
+ new
+ setlocal comments=Ob:* fo+=ro
+ exe "normal i* B\nD\<C-C>kOA\<C-C>joC"
+ let expected =<< trim END
+ A
+ * B
+ * C
+ * D
+ END
+ call assert_equal(expected, getline(1, '$'))
+ %bw!
+endfunc
+
" Test for 'a' and 'w' flags in 'formatoptions'
func Test_fo_a_w()
new
@@ -1299,6 +1334,25 @@ func Test_fo_a_w()
%bw!
endfunc
+" Test for 'j' flag in 'formatoptions'
+func Test_fo_j()
+ new
+ setlocal fo+=j comments=://
+ call setline(1, ['i++; // comment1', ' // comment2'])
+ normal J
+ call assert_equal('i++; // comment1 comment2', getline(1))
+ setlocal fo-=j
+ call setline(1, ['i++; // comment1', ' // comment2'])
+ normal J
+ call assert_equal('i++; // comment1 // comment2', getline(1))
+ " Test with nested comments
+ setlocal fo+=j comments=n:>,n:)
+ call setline(1, ['i++; > ) > ) comment1', ' > ) comment2'])
+ normal J
+ call assert_equal('i++; > ) > ) comment1 comment2', getline(1))
+ %bw!
+endfunc
+
" Test for formatting lines using gq in visual mode
func Test_visual_gq_format()
new