diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2022-07-15 10:11:41 +0800 |
|---|---|---|
| committer | zeertzjq <zeertzjq@outlook.com> | 2022-07-15 10:50:21 +0800 |
| commit | 465b73c3a5f1debc0c88e0e2d569f8cdebc51b5b (patch) | |
| tree | d57568b30353002faa5e923ca0ffb8ea434797fc /src/nvim/testdir/test_textformat.vim | |
| parent | c821b5c6955e6e15039298d50641608168159c01 (diff) | |
| download | rneovim-465b73c3a5f1debc0c88e0e2d569f8cdebc51b5b.tar.gz rneovim-465b73c3a5f1debc0c88e0e2d569f8cdebc51b5b.tar.bz2 rneovim-465b73c3a5f1debc0c88e0e2d569f8cdebc51b5b.zip | |
vim-patch:8.2.0482: channel and sandbox code not sufficiently tested
Problem: Channel and sandbox code not sufficiently tested.
Solution: Add more tests. (Yegappan Lakshmanan, closes vim/vim#5855)
https://github.com/vim/vim/commit/ca68ae13114619df3e4c195b41ad0575516f5ff6
Cherry-pick test_clientserver.vim changes form patch 8.2.0448.
Diffstat (limited to 'src/nvim/testdir/test_textformat.vim')
| -rw-r--r-- | src/nvim/testdir/test_textformat.vim | 75 |
1 files changed, 73 insertions, 2 deletions
diff --git a/src/nvim/testdir/test_textformat.vim b/src/nvim/testdir/test_textformat.vim index 748af199b2..f0a0f894c3 100644 --- a/src/nvim/testdir/test_textformat.vim +++ b/src/nvim/testdir/test_textformat.vim @@ -1137,8 +1137,79 @@ func Test_whichwrap_multi_byte() bwipe! endfunc -func Test_substitute() - call assert_equal('a1a2a3a', substitute('123', '\zs', 'a', 'g')) +" Test for the 'f' flag in 'comments' (only the first line has the comment +" string) +func Test_firstline_comment() + new + setlocal comments=f:- fo+=ro + exe "normal i- B\nD\<C-C>ggoC\<C-C>ggOA\<C-C>" + call assert_equal(['A', '- B', ' C', ' D'], getline(1, '$')) + %d + setlocal comments=:- + exe "normal i- B\nD\<C-C>ggoC\<C-C>ggOA\<C-C>" + call assert_equal(['- A', '- B', '- C', '- D'], getline(1, '$')) + %bw! +endfunc + +" Test for the 'r' flag in 'comments' (right align comment) +func Test_comment_rightalign() + new + setlocal comments=sr:/***,m:**,ex-2:******/ fo+=ro + exe "normal i=\<C-C>o\t /***\nD\n/" + exe "normal 2GOA\<C-C>joB\<C-C>jOC\<C-C>joE\<C-C>GOF\<C-C>joG" + let expected =<< trim END + = + A + /*** + ** B + ** C + ** D + ** E + ** F + ******/ + G + END + call assert_equal(expected, getline(1, '$')) + %bw! +endfunc + +" Test for the 'b' flag in 'comments' +func Test_comment_blank() + new + setlocal comments=b:* fo+=ro + exe "normal i* E\nF\n\<BS>G\nH\<C-C>ggOC\<C-C>O\<BS>B\<C-C>OA\<C-C>2joD" + let expected =<< trim END + A + *B + * C + * D + * E + * F + *G + H + END + call assert_equal(expected, getline(1, '$')) + %bw! +endfunc + +" Test for the 'n' flag in comments +func Test_comment_nested() + new + setlocal comments=n:> fo+=ro + exe "normal i> B\nD\<C-C>ggOA\<C-C>joC\<C-C>Go\<BS>>>> F\nH" + exe "normal 5GOE\<C-C>6GoG" + let expected =<< trim END + > A + > B + > C + > D + >>>> E + >>>> F + >>>> G + >>>> H + END + call assert_equal(expected, getline(1, '$')) + %bw! endfunc " Test for 'a' and 'w' flags in 'formatoptions' |