diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-04-04 14:00:39 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-04-04 14:00:39 +0200 |
commit | cde0ff39da2459b16007fef701ebaa449fb6fe9d (patch) | |
tree | 9ba0f500505470043d6e78a30600419375d4c76f /src/testdir/test_textformat.vim | |
parent | d77a8525d5438cae49f670eb473ef60d87ca5f54 (diff) | |
download | vim-git-cde0ff39da2459b16007fef701ebaa449fb6fe9d.tar.gz |
patch 8.2.0509: various code is not properly tested.v8.2.0509
Problem: various code is not properly tested.
Solution: Add more tests. (Yegappan Lakshmanan, closes #5871)
Diffstat (limited to 'src/testdir/test_textformat.vim')
-rw-r--r-- | src/testdir/test_textformat.vim | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/testdir/test_textformat.vim b/src/testdir/test_textformat.vim index bb41e45a2..90c95aeb2 100644 --- a/src/testdir/test_textformat.vim +++ b/src/testdir/test_textformat.vim @@ -1026,6 +1026,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 @@ -1035,4 +1070,23 @@ 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 + " vim: shiftwidth=2 sts=2 expandtab |