From af23d173883f47fd02a9a380c719e4428370b484 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Tue, 7 Mar 2023 04:13:04 +0100 Subject: test: move oldtests to test directory (#22536) The new oldtest directory is in test/old/testdir. The reason for this is that many tests have hardcoded the parent directory name to be 'testdir'. --- test/old/testdir/test_blockedit.vim | 132 ++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 test/old/testdir/test_blockedit.vim (limited to 'test/old/testdir/test_blockedit.vim') diff --git a/test/old/testdir/test_blockedit.vim b/test/old/testdir/test_blockedit.vim new file mode 100644 index 0000000000..7b56b1554f --- /dev/null +++ b/test/old/testdir/test_blockedit.vim @@ -0,0 +1,132 @@ +" Test for block inserting +" + +func Test_blockinsert_indent() + new + filetype plugin indent on + setlocal sw=2 et ft=vim + call setline(1, ['let a=[', ' ''eins'',', ' ''zwei'',', ' ''drei'']']) + call cursor(2, 3) + exe "norm! \2jI\\ \" + call assert_equal(['let a=[', ' \ ''eins'',', ' \ ''zwei'',', ' \ ''drei'']'], + \ getline(1,'$')) + " reset to sane state + filetype off + bwipe! +endfunc + +func Test_blockinsert_autoindent() + new + let lines =<< trim END + var d = { + a: () => 0, + b: () => 0, + c: () => 0, + } + END + call setline(1, lines) + filetype plugin indent on + setlocal sw=2 et ft=vim + setlocal indentkeys+=: + exe "norm! 2Gf)\2jA: asdf\" + let expected =<< trim END + var d = { + a: (): asdf => 0, + b: (): asdf => 0, + c: (): asdf => 0, + } + END + call assert_equal(expected, getline(1, 5)) + + " insert on the next column should do exactly the same + :%dele + call setline(1, lines) + exe "norm! 2Gf)l\2jI: asdf\" + call assert_equal(expected, getline(1, 5)) + + :%dele + call setline(1, lines) + setlocal sw=8 noet + exe "norm! 2Gf)\2jA: asdf\" + let expected =<< trim END + var d = { + a: (): asdf => 0, + b: (): asdf => 0, + c: (): asdf => 0, + } + END + call assert_equal(expected, getline(1, 5)) + + " insert on the next column should do exactly the same + :%dele + call setline(1, lines) + exe "norm! 2Gf)l\2jI: asdf\" + call assert_equal(expected, getline(1, 5)) + + filetype off + bwipe! +endfunc + +func Test_blockinsert_delete() + new + let _bs = &bs + set bs=2 + call setline(1, ['case Arg is ', ' when Name_Async,', ' when Name_Num_Gangs,', 'end if;']) + exe "norm! ggjVj\$o$A\\" + "call feedkeys("Vj\$o$A\\", 'ti') + call assert_equal(["case Arg is ", " when Name_Async", " when Name_Num_Gangs,", "end if;"], + \ getline(1,'$')) + " reset to sane state + let &bs = _bs + bwipe! +endfunc + +func Test_blockappend_eol_cursor() + new + " Test 1 Move 1 char left + call setline(1, ['aaa', 'bbb', 'ccc']) + exe "norm! gg$\2jA\x\" + call assert_equal(['aaxa', 'bbxb', 'ccxc'], getline(1, '$')) + " Test 2 Move 2 chars left + sil %d + call setline(1, ['aaa', 'bbb', 'ccc']) + exe "norm! gg$\2jA\\x\" + call assert_equal(['axaa', 'bxbb', 'cxcc'], getline(1, '$')) + " Test 3 Move 3 chars left (outside of the visual selection) + sil %d + call setline(1, ['aaa', 'bbb', 'ccc']) + exe "norm! ggl$\2jA\\\x\" + call assert_equal(['xaaa', 'bbb', 'ccc'], getline(1, '$')) + bw! +endfunc + +func Test_blockappend_eol_cursor2() + new + " Test 1 Move 1 char left + call setline(1, ['aaaaa', 'bbb', 'ccccc']) + exe "norm! gg\$2jA\x\" + call assert_equal(['aaaaxa', 'bbbx', 'ccccxc'], getline(1, '$')) + " Test 2 Move 2 chars left + sil %d + call setline(1, ['aaaaa', 'bbb', 'ccccc']) + exe "norm! gg\$2jA\\x\" + call assert_equal(['aaaxaa', 'bbbx', 'cccxcc'], getline(1, '$')) + " Test 3 Move 3 chars left (to the beginning of the visual selection) + sil %d + call setline(1, ['aaaaa', 'bbb', 'ccccc']) + exe "norm! gg\$2jA\\\x\" + call assert_equal(['aaxaaa', 'bbxb', 'ccxccc'], getline(1, '$')) + " Test 4 Move 3 chars left (outside of the visual selection) + sil %d + call setline(1, ['aaaaa', 'bbb', 'ccccc']) + exe "norm! ggl\$2jA\\\x\" + call assert_equal(['aaxaaa', 'bbxb', 'ccxccc'], getline(1, '$')) + " Test 5 Move 4 chars left (outside of the visual selection) + sil %d + call setline(1, ['aaaaa', 'bbb', 'ccccc']) + exe "norm! ggl\$2jA\\\\x\" + call assert_equal(['axaaaa', 'bxbb', 'cxcccc'], getline(1, '$')) + bw! +endfunc + +" vim: shiftwidth=2 sts=2 expandtab -- cgit From dd8ebea01e26445d540272147f317b6f0b3cfff4 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 4 May 2023 12:28:51 +0800 Subject: vim-patch:9.0.0609: blockedit test fails because of wrong indent Problem: Blockedit test fails because of wrong indent. Solution: Adjust the expected text temporarily https://github.com/vim/vim/commit/66000ff9af8e3de93825ce7baa0c43727465eca5 Co-authored-by: Bram Moolenaar --- test/old/testdir/test_blockedit.vim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'test/old/testdir/test_blockedit.vim') diff --git a/test/old/testdir/test_blockedit.vim b/test/old/testdir/test_blockedit.vim index 7b56b1554f..2d58f0acf9 100644 --- a/test/old/testdir/test_blockedit.vim +++ b/test/old/testdir/test_blockedit.vim @@ -29,9 +29,10 @@ func Test_blockinsert_autoindent() setlocal sw=2 et ft=vim setlocal indentkeys+=: exe "norm! 2Gf)\2jA: asdf\" + " FIXME: what do we really expect? let expected =<< trim END var d = { - a: (): asdf => 0, + a: (): asdf => 0, b: (): asdf => 0, c: (): asdf => 0, } @@ -48,9 +49,10 @@ func Test_blockinsert_autoindent() call setline(1, lines) setlocal sw=8 noet exe "norm! 2Gf)\2jA: asdf\" + " FIXME: what do we really expect? let expected =<< trim END var d = { - a: (): asdf => 0, + a: (): asdf => 0, b: (): asdf => 0, c: (): asdf => 0, } -- cgit From ecfca812d660fd02e1fb71d0fbbd57d7a4dbf21a Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 4 May 2023 12:29:01 +0800 Subject: vim-patch:9.0.0612: blockedit test passes with wrong result Problem: Blockedit test passes with wrong result. Solution: Add a "vim9script" line to make indenting work. https://github.com/vim/vim/commit/47da934844afec7b04d94e0d1f8cf0a86e1b9bea Co-authored-by: Bram Moolenaar --- test/old/testdir/test_blockedit.vim | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'test/old/testdir/test_blockedit.vim') diff --git a/test/old/testdir/test_blockedit.vim b/test/old/testdir/test_blockedit.vim index 2d58f0acf9..e0cfe11af0 100644 --- a/test/old/testdir/test_blockedit.vim +++ b/test/old/testdir/test_blockedit.vim @@ -18,6 +18,7 @@ endfunc func Test_blockinsert_autoindent() new let lines =<< trim END + vim9script var d = { a: () => 0, b: () => 0, @@ -28,42 +29,42 @@ func Test_blockinsert_autoindent() filetype plugin indent on setlocal sw=2 et ft=vim setlocal indentkeys+=: - exe "norm! 2Gf)\2jA: asdf\" - " FIXME: what do we really expect? + exe "norm! 3Gf)\2jA: asdf\" let expected =<< trim END + vim9script var d = { - a: (): asdf => 0, + a: (): asdf => 0, b: (): asdf => 0, c: (): asdf => 0, } END - call assert_equal(expected, getline(1, 5)) + call assert_equal(expected, getline(1, 6)) " insert on the next column should do exactly the same :%dele call setline(1, lines) - exe "norm! 2Gf)l\2jI: asdf\" - call assert_equal(expected, getline(1, 5)) + exe "norm! 3Gf)l\2jI: asdf\" + call assert_equal(expected, getline(1, 6)) :%dele call setline(1, lines) setlocal sw=8 noet - exe "norm! 2Gf)\2jA: asdf\" - " FIXME: what do we really expect? + exe "norm! 3Gf)\2jA: asdf\" let expected =<< trim END + vim9script var d = { - a: (): asdf => 0, + a: (): asdf => 0, b: (): asdf => 0, c: (): asdf => 0, } END - call assert_equal(expected, getline(1, 5)) + call assert_equal(expected, getline(1, 6)) " insert on the next column should do exactly the same :%dele call setline(1, lines) - exe "norm! 2Gf)l\2jI: asdf\" - call assert_equal(expected, getline(1, 5)) + exe "norm! 3Gf)l\2jI: asdf\" + call assert_equal(expected, getline(1, 6)) filetype off bwipe! -- cgit