From 2de447b60c04fcaad3d762851c512b2545ea6bad Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Fri, 2 Feb 2018 23:14:30 +0100 Subject: vim-patch:8.0.1221: still too many old style tests Problem: Still too many old style tests. Solution: Convert a few more tests to new style. (Yegappan Lakshmanan, closes vim/vim#2256) https://github.com/vim/vim/commit/15993ce9210e8b8d4bc11e1d640f6447b18d3e6c --- src/nvim/testdir/test_visual.vim | 99 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) (limited to 'src/nvim/testdir/test_visual.vim') diff --git a/src/nvim/testdir/test_visual.vim b/src/nvim/testdir/test_visual.vim index 6a61942025..5901e970ef 100644 --- a/src/nvim/testdir/test_visual.vim +++ b/src/nvim/testdir/test_visual.vim @@ -52,3 +52,102 @@ func Test_Visual_inner_quote() normal vki' bwipe! endfunc + +" Test for visual block shift and tab characters. +func Test_block_shift_tab() + enew! + call append(0, repeat(['one two three'], 5)) + call cursor(1,1) + exe "normal i\u" + exe "normal fe\4jR\ugvr1" + call assert_equal('on1 two three', getline(1)) + call assert_equal('on1 two three', getline(2)) + call assert_equal('on1 two three', getline(5)) + + enew! + call append(0, repeat(['abcdefghijklmnopqrstuvwxyz'], 5)) + call cursor(1,1) + exe "normal \4jI \j<<11|D" + exe "normal j7|a\\" + exe "normal j7|a\\ " + exe "normal j7|a\ \\4k13|\4j<" + call assert_equal(' abcdefghijklmnopqrstuvwxyz', getline(1)) + call assert_equal('abcdefghij', getline(2)) + call assert_equal(" abc\ defghijklmnopqrstuvwxyz", getline(3)) + call assert_equal(" abc\ defghijklmnopqrstuvwxyz", getline(4)) + call assert_equal(" abc\ defghijklmnopqrstuvwxyz", getline(5)) + + %s/\s\+//g + call cursor(1,1) + exe "normal \4jI \j<<" + exe "normal j7|a\\" + exe "normal j7|a\\\\\" + exe "normal j7|a\ \\\4k13|\4j3<" + call assert_equal(' abcdefghijklmnopqrstuvwxyz', getline(1)) + call assert_equal('abcdefghij', getline(2)) + call assert_equal(" abc\ defghijklmnopqrstuvwxyz", getline(3)) + call assert_equal(" abc\\defghijklmnopqrstuvwxyz", getline(4)) + call assert_equal(" abc\ defghijklmnopqrstuvwxyz", getline(5)) + + enew! +endfunc + +" Tests Blockwise Visual when there are TABs before the text. +func Test_blockwise_visual() + enew! + call append(0, ['123456', + \ '234567', + \ '345678', + \ '', + \ 'test text test tex start here', + \ "\t\tsome text", + \ "\t\ttest text", + \ 'test text']) + call cursor(1,1) + exe "normal /start here$\" + exe 'normal "by$' . "\jjlld" + exe "normal /456$\" + exe "normal \jj" . '"bP' + call assert_equal(['123start here56', + \ '234start here67', + \ '345start here78', + \ '', + \ 'test text test tex rt here', + \ "\t\tsomext", + \ "\t\ttesext"], getline(1, 7)) + + enew! +endfunc + +" Test Virtual replace mode. +func Test_virtual_replace() + exe "set t_kD=\x7f t_kb=\x08" + enew! + exe "normal a\nabcdefghi\njk\tlmn\n opq rst\n\uvwxyz" + call cursor(1,1) + set ai bs=2 + exe "normal gR0\ 1\nA\nBCDEFGHIJ\n\tKL\nMNO\nPQR" + call assert_equal([' 1', + \ ' A', + \ ' BCDEFGHIJ', + \ ' KL', + \ ' MNO', + \ ' PQR', + \ ], getline(1, 6)) + normal G + mark a + exe "normal o0\\nabcdefghi\njk\tlmn\n opq\trst\n\uvwxyz\n" + exe "normal 'ajgR0\ 1\nA\nBCDEFGHIJ\n\tKL\nMNO\nPQR" . repeat("\", 29) + call assert_equal([' 1', + \ 'abcdefghi', + \ 'jk lmn', + \ ' opq rst', + \ 'uvwxyz'], getline(7, 11)) + normal G + exe "normal iab\tcdefghi\tjkl" + exe "normal 0gRAB......CDEFGHI.J\o" + exe "normal iabcdefghijklmnopqrst\0gRAB\tIJKLMNO\tQR" + call assert_equal(['AB......CDEFGHI.Jkl', + \ 'AB IJKLMNO QRst'], getline(12, 13)) + enew! +endfunc -- cgit