From 32a2c556ab3697111f01c9ef50447ec5d78070f7 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 4 Nov 2022 19:42:10 +0800 Subject: vim-patch:8.2.0968: no proper testing of the 'cpoptions' flags Problem: No proper testing of the 'cpoptions' flags. Solution: Add tests. (Yegappan Lakshmanan, closes vim/vim#6251) https://github.com/vim/vim/commit/c9630d2658af9dcaa01913e899b201bfdef7b536 --- src/nvim/testdir/test_normal.vim | 79 ---------------------------------------- 1 file changed, 79 deletions(-) (limited to 'src/nvim/testdir/test_normal.vim') diff --git a/src/nvim/testdir/test_normal.vim b/src/nvim/testdir/test_normal.vim index 32bb755584..3c9a7a3986 100644 --- a/src/nvim/testdir/test_normal.vim +++ b/src/nvim/testdir/test_normal.vim @@ -2931,20 +2931,6 @@ func Test_normal52_rl() bw! endfunc -func Test_normal53_digraph() - CheckFeature digraphs - new - call setline(1, 'abcdefgh|') - exe "norm! 1gg0f\!!" - call assert_equal(9, col('.')) - set cpo+=D - exe "norm! 1gg0f\!!" - call assert_equal(1, col('.')) - - set cpo-=D - bw! -endfunc - func Test_normal54_Ctrl_bsl() new call setline(1, 'abcdefghijklmn') @@ -3265,46 +3251,6 @@ func Test_normal_gk_gj() set cpoptions& number& numberwidth& wrap& endfunc -" Test for cursor movement with '-' in 'cpoptions' -func Test_normal_cpo_minus() - throw 'Skipped: Nvim does not support cpoptions flag "-"' - new - call setline(1, ['foo', 'bar', 'baz']) - let save_cpo = &cpo - set cpo+=- - call assert_beeps('normal 10j') - call assert_equal(1, line('.')) - normal G - call assert_beeps('normal 10k') - call assert_equal(3, line('.')) - call assert_fails(10, 'E16:') - let &cpo = save_cpo - close! -endfunc - -" Test for displaying dollar when changing text ('$' flag in 'cpoptions') -func Test_normal_cpo_dollar() - throw 'Skipped: use test/functional/legacy/cpoptions_spec.lua' - new - let g:Line = '' - func SaveFirstLine() - let g:Line = Screenline(1) - return '' - endfunc - inoremap SaveFirstLine() - call test_override('redraw_flag', 1) - set cpo+=$ - call setline(1, 'one two three') - redraw! - exe "normal c2w\vim" - call assert_equal('one tw$ three', g:Line) - call assert_equal('vim three', getline(1)) - set cpo-=$ - call test_override('ALL', 0) - delfunc SaveFirstLine - %bw! -endfunc - " Test for using : to run a multi-line Ex command in operator pending mode func Test_normal_yank_with_excmd() new @@ -3387,31 +3333,6 @@ func Test_normal_delete_cmd() close! endfunc -" Test for the 'E' flag in 'cpo' with yank, change, delete, etc. operators -func Test_empty_region_error() - new - call setline(1, '') - set cpo+=E - " yank an empty line - call assert_beeps('normal "ayl') - " change an empty line - call assert_beeps('normal lcTa') - " delete an empty line - call assert_beeps('normal D') - call assert_beeps('normal dl') - call assert_equal('', getline(1)) - " change case of an empty line - call assert_beeps('normal gul') - call assert_beeps('normal gUl') - " replace a character - call assert_beeps('normal vrx') - " increment and decrement - call assert_beeps('exe "normal v\"') - call assert_beeps('exe "normal v\"') - set cpo-=E - close! -endfunc - " Test for deleting or changing characters across lines with 'whichwrap' " containing 's'. Should count as one character. func Test_normal_op_across_lines() -- cgit From 2b86ca81b400b1311379f3258cc6c38be94fcf36 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 4 Nov 2022 19:51:54 +0800 Subject: vim-patch:8.2.0976: some 'cpoptions' not tested Problem: Some 'cpoptions' not tested. Solution: Add more tests. (Yegappan Lakshmanan, closes vim/vim#6253) https://github.com/vim/vim/commit/df7df59d85e7e56a796912dc865488a75d3f0e53 --- src/nvim/testdir/test_normal.vim | 9 --------- 1 file changed, 9 deletions(-) (limited to 'src/nvim/testdir/test_normal.vim') diff --git a/src/nvim/testdir/test_normal.vim b/src/nvim/testdir/test_normal.vim index 3c9a7a3986..04faeca455 100644 --- a/src/nvim/testdir/test_normal.vim +++ b/src/nvim/testdir/test_normal.vim @@ -2644,7 +2644,6 @@ endfunc " Test for cw cW ce func Test_normal39_cw() " Test for cw and cW on whitespace - " and cpo+=w setting new set tw=0 call append(0, 'here are some words') @@ -2652,14 +2651,6 @@ func Test_normal39_cw() call assert_equal('hereZZZare some words', getline('.')) norm! 1gg0elcWYYY call assert_equal('hereZZZareYYYsome words', getline('.')) - " Nvim: no "w" flag in 'cpoptions'. - " set cpo+=w - " call setline(1, 'here are some words') - " norm! 1gg0elcwZZZ - " call assert_equal('hereZZZ are some words', getline('.')) - " norm! 1gg2elcWYYY - " call assert_equal('hereZZZ areYYY some words', getline('.')) - set cpo-=w norm! 2gg0cwfoo call assert_equal('foo', getline('.')) -- cgit From 26a9f786c41bc8fa383e3ffe55a1fe77b50fb320 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 4 Nov 2022 20:31:25 +0800 Subject: vim-patch:8.2.1810: some code in normal.c not covered by tests Problem: Some code in normal.c not covered by tests. Solution: Add normal mode tests. (Yegappan Lakshmanan, closes vim/vim#7086) https://github.com/vim/vim/commit/d7e5e9430ae192c76f1f03c3ac53fae823d94c33 --- src/nvim/testdir/test_normal.vim | 68 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) (limited to 'src/nvim/testdir/test_normal.vim') diff --git a/src/nvim/testdir/test_normal.vim b/src/nvim/testdir/test_normal.vim index 04faeca455..6804d549c6 100644 --- a/src/nvim/testdir/test_normal.vim +++ b/src/nvim/testdir/test_normal.vim @@ -120,6 +120,39 @@ func Test_normal01_keymodel() call feedkeys("Vkk\yy", 'tx') call assert_equal(['47', '48', '49', '50'], getreg(0, 0, 1)) + " Test for using special keys to start visual selection + %d + call setline(1, ['red fox tail', 'red fox tail', 'red fox tail']) + set keymodel=startsel + " Test for and + call cursor(1, 1) + call feedkeys("\y", 'xt') + call assert_equal([0, 1, 1, 0], getpos("'<")) + call assert_equal([0, 3, 1, 0], getpos("'>")) + call feedkeys("Gz\8|\y", 'xt') + call assert_equal([0, 2, 1, 0], getpos("'<")) + call assert_equal([0, 3, 8, 0], getpos("'>")) + " Test for and + call cursor(2, 12) + call feedkeys("\y", 'xt') + call assert_equal([0, 1, 1, 0], getpos("'<")) + call assert_equal([0, 2, 12, 0], getpos("'>")) + call cursor(1, 4) + call feedkeys("\y", 'xt') + call assert_equal([0, 1, 4, 0], getpos("'<")) + call assert_equal([0, 3, 13, 0], getpos("'>")) + " Test for and + call cursor(2, 5) + call feedkeys("\y", 'xt') + call assert_equal([0, 2, 5, 0], getpos("'<")) + call assert_equal([0, 2, 9, 0], getpos("'>")) + call cursor(2, 9) + call feedkeys("\y", 'xt') + call assert_equal([0, 2, 5, 0], getpos("'<")) + call assert_equal([0, 2, 9, 0], getpos("'>")) + + set keymodel& + " clean up bw! endfunc @@ -509,6 +542,14 @@ func Test_normal10_expand() call assert_equal(expected[i], expand(''), 'i == ' . i) endfor + " Test for in state.val and ptr->val + call setline(1, 'x = state.val;') + call cursor(1, 10) + call assert_equal('state.val', expand('')) + call setline(1, 'x = ptr->val;') + call cursor(1, 9) + call assert_equal('ptr->val', expand('')) + if executable('echo') " Test expand(`...`) i.e. backticks command expansion. " MS-Windows has a trailing space. @@ -523,6 +564,19 @@ func Test_normal10_expand() bw! endfunc +" Test for expand() in latin1 encoding +func Test_normal_expand_latin1() + new + let save_enc = &encoding + " set encoding=latin1 + call setline(1, 'val = item->color;') + call cursor(1, 11) + call assert_equal('color', expand("")) + call assert_equal('item->color', expand("")) + let &encoding = save_enc + bw! +endfunc + func Test_normal11_showcmd() " test for 'showcmd' 10new @@ -547,6 +601,13 @@ func Test_normal11_showcmd() redraw! call assert_match('1-3$', Screenline(&lines)) call feedkeys("v", 'xt') + " test for visually selecting the end of line + call setline(1, ["foobar"]) + call feedkeys("$vl", 'xt') + redraw! + call assert_match('2$', Screenline(&lines)) + call feedkeys("y", 'xt') + call assert_equal("r\n", @") bw! endfunc @@ -2161,6 +2222,13 @@ func Test_normal31_r_cmd() normal gglvjjrx call assert_equal(['axx', 'xxx', 'xxf'], getline(1, '$')) + " replace with a multibyte character (with multiple composing characters) + %d + new + call setline(1, 'aaa') + exe "normal $ra\u0328\u0301" + call assert_equal("aaa\u0328\u0301", getline(1)) + " clean up set noautoindent bw! -- cgit From 2aafaa59928e17fd7858a89d203e2b2a07707601 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 4 Nov 2022 20:41:53 +0800 Subject: vim-patch:8.2.2901: some operators not fully tested Problem: Some operators not fully tested. Solution: Add a few test cases. (Yegappan Lakshmanan, closes vim/vim#8282) https://github.com/vim/vim/commit/3e72dcad8b752a42b6eaf71213e3f5d534175256 --- src/nvim/testdir/test_normal.vim | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/nvim/testdir/test_normal.vim') diff --git a/src/nvim/testdir/test_normal.vim b/src/nvim/testdir/test_normal.vim index 6804d549c6..5fc670e422 100644 --- a/src/nvim/testdir/test_normal.vim +++ b/src/nvim/testdir/test_normal.vim @@ -2125,6 +2125,16 @@ func Test_normal30_changecase() call assert_equal(['aaaaaa', 'AAAAaa'], getline(1, 2)) set whichwrap& + " try changing the case with a double byte encoding (DBCS) + %bw! + let enc = &enc + " set encoding=cp932 + call setline(1, "\u8470") + normal ~ + normal gU$gu$gUgUg~g~gugu + call assert_equal("\u8470", getline(1)) + let &encoding = enc + " clean up bw! endfunc @@ -3499,6 +3509,27 @@ func Test_normal_percent_jump() close! endfunc +" Test for << and >> commands to shift text by 'shiftwidth' +func Test_normal_shift_rightleft() + new + call setline(1, ['one', '', "\t", ' two', "\tthree", ' four']) + set shiftwidth=2 tabstop=8 + normal gg6>> + call assert_equal([' one', '', "\t ", ' two', "\t three", "\tfour"], + \ getline(1, '$')) + normal ggVG2>> + call assert_equal([' one', '', "\t ", "\ttwo", + \ "\t three", "\t four"], getline(1, '$')) + normal gg6<< + call assert_equal([' one', '', "\t ", ' two', "\t three", + \ "\t four"], getline(1, '$')) + normal ggVG2<< + call assert_equal(['one', '', "\t", ' two', "\tthree", ' four'], + \ getline(1, '$')) + set shiftwidth& tabstop& + bw! +endfunc + " Some commands like yy, cc, dd, >>, << and !! accept a count after " typing the first letter of the command. func Test_normal_count_after_operator() -- cgit