From 780edfc0eb1293f5813d904ad61fc65bbbb41784 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 16 Jul 2022 21:39:05 +0800 Subject: vim-patch:8.2.2608: character input not fully tested Problem: Character input not fully tested. Solution: Add more tests. (Yegappan Lakshmanan, closes vim/vim#7963) https://github.com/vim/vim/commit/f4fcedc59d4cc5ae6b5270a933e8377030283c1c Cherry-pick related changes from patches 8.2.{0433,0866}. --- src/nvim/testdir/test_undo.vim | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/nvim/testdir/test_undo.vim') diff --git a/src/nvim/testdir/test_undo.vim b/src/nvim/testdir/test_undo.vim index da8bf12318..efc39fb3f5 100644 --- a/src/nvim/testdir/test_undo.vim +++ b/src/nvim/testdir/test_undo.vim @@ -735,6 +735,20 @@ func Test_undofile_cryptmethod_blowfish2() set undofile& undolevels& cryptmethod& endfunc +" Test for redoing with incrementing numbered registers +func Test_redo_repeat_numbered_register() + new + for [i, v] in [[1, 'one'], [2, 'two'], [3, 'three'], + \ [4, 'four'], [5, 'five'], [6, 'six'], + \ [7, 'seven'], [8, 'eight'], [9, 'nine']] + exe 'let @' .. i .. '="' .. v .. '\n"' + endfor + call feedkeys('"1p.........', 'xt') + call assert_equal(['', 'one', 'two', 'three', 'four', 'five', 'six', + \ 'seven', 'eight', 'nine', 'nine'], getline(1, '$')) + bwipe! +endfunc + func Test_undo_mark() new " The undo is applied to the only line. -- cgit From 0cfd4fa8f3dc2241de5f69d5c52510542dfc927c Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sat, 16 Jul 2022 21:56:47 +0800 Subject: vim-patch:8.2.2643: various code not covered by tests Problem: Various code not covered by tests. Solution: Add a few more test. (Yegappan Lakshmanan, closes vim/vim#7995) https://github.com/vim/vim/commit/1f448d906b3c516e5864dc5bae3ddbf3664ee649 Cherry-pick some test_edit.vim changes from patches 8.2.{1022,1432}. Reorder test_undo.vim to match upstream. --- src/nvim/testdir/test_undo.vim | 127 ++++++++++++++++++++++------------------- 1 file changed, 67 insertions(+), 60 deletions(-) (limited to 'src/nvim/testdir/test_undo.vim') diff --git a/src/nvim/testdir/test_undo.vim b/src/nvim/testdir/test_undo.vim index efc39fb3f5..a9ec405aa4 100644 --- a/src/nvim/testdir/test_undo.vim +++ b/src/nvim/testdir/test_undo.vim @@ -3,8 +3,6 @@ " undo-able pieces. Do that by setting 'undolevels'. " Also tests :earlier and :later. -source check.vim - func Test_undotree() new @@ -137,8 +135,7 @@ func BackOne(expected) endfunc func Test_undo_del_chars() - CheckFunction test_settime - + throw 'Skipped: Nvim does not support test_settime()' " Setup a buffer without creating undo entries new set ul=-1 @@ -334,8 +331,9 @@ func Test_insert_expr() endfunc func Test_undofile_earlier() - CheckFunction test_settime - + throw 'Skipped: Nvim does not support test_settime()' + " Issue #1254 + " create undofile with timestamps older than Vim startup time. let t0 = localtime() - 43200 call test_settime(t0) new Xfile @@ -368,7 +366,7 @@ func Test_wundo_errors() bwipe! endfunc -" Check that reading a truncted undo file doesn't hang. +" Check that reading a truncated undo file doesn't hang. func Test_undofile_truncated() new call setline(1, 'hello') @@ -431,6 +429,59 @@ func Test_cmd_in_reg_undo() let @a = '' endfunc +" This used to cause an illegal memory access +func Test_undo_append() + new + call feedkeys("axx\v", 'xt') + undo + norm o + quit +endfunc + +func Test_undo_0() + new + set ul=100 + normal i1 + undo + normal i2 + undo + normal i3 + + undo 0 + let d = undotree() + call assert_equal('', getline(1)) + call assert_equal(0, d.seq_cur) + + redo + let d = undotree() + call assert_equal('3', getline(1)) + call assert_equal(3, d.seq_cur) + + undo 2 + undo 0 + let d = undotree() + call assert_equal('', getline(1)) + call assert_equal(0, d.seq_cur) + + redo + let d = undotree() + call assert_equal('2', getline(1)) + call assert_equal(2, d.seq_cur) + + undo 1 + undo 0 + let d = undotree() + call assert_equal('', getline(1)) + call assert_equal(0, d.seq_cur) + + redo + let d = undotree() + call assert_equal('1', getline(1)) + call assert_equal(1, d.seq_cur) + + bwipe! +endfunc + " undo or redo are noop if there is nothing to undo or redo func Test_undo_redo_noop() new @@ -456,15 +507,6 @@ func Test_redo_empty_line() bwipe! endfunc -" This used to cause an illegal memory access -func Test_undo_append() - new - call feedkeys("axx\v", 'xt') - undo - norm o - quit -endfunc - funct Test_undofile() " Test undofile() without setting 'undodir'. if has('persistent_undo') @@ -506,50 +548,6 @@ funct Test_undofile() set undodir& endfunc -func Test_undo_0() - new - set ul=100 - normal i1 - undo - normal i2 - undo - normal i3 - - undo 0 - let d = undotree() - call assert_equal('', getline(1)) - call assert_equal(0, d.seq_cur) - - redo - let d = undotree() - call assert_equal('3', getline(1)) - call assert_equal(3, d.seq_cur) - - undo 2 - undo 0 - let d = undotree() - call assert_equal('', getline(1)) - call assert_equal(0, d.seq_cur) - - redo - let d = undotree() - call assert_equal('2', getline(1)) - call assert_equal(2, d.seq_cur) - - undo 1 - undo 0 - let d = undotree() - call assert_equal('', getline(1)) - call assert_equal(0, d.seq_cur) - - redo - let d = undotree() - call assert_equal('1', getline(1)) - call assert_equal(1, d.seq_cur) - - bwipe! -endfunc - " Tests for the undo file " Explicitly break changes up in undo-able pieces by setting 'undolevels'. func Test_undofile_2() @@ -749,6 +747,15 @@ func Test_redo_repeat_numbered_register() bwipe! endfunc +" Test for redo in insert mode using CTRL-O with multibyte characters +func Test_redo_multibyte_in_insert_mode() + new + call feedkeys("a\ft", 'xt') + call feedkeys("uiHe\.llo", 'xt') + call assert_equal("He\ufb05llo", getline(1)) + bwipe! +endfunc + func Test_undo_mark() new " The undo is applied to the only line. -- cgit