diff options
| author | zeertzjq <zeertzjq@outlook.com> | 2022-07-16 21:56:47 +0800 |
|---|---|---|
| committer | zeertzjq <zeertzjq@outlook.com> | 2022-07-16 22:46:54 +0800 |
| commit | 0cfd4fa8f3dc2241de5f69d5c52510542dfc927c (patch) | |
| tree | 0a7a764842acb866073ad177f5afc5bcaed3bd9c /src/nvim/testdir/test_edit.vim | |
| parent | 780edfc0eb1293f5813d904ad61fc65bbbb41784 (diff) | |
| download | rneovim-0cfd4fa8f3dc2241de5f69d5c52510542dfc927c.tar.gz rneovim-0cfd4fa8f3dc2241de5f69d5c52510542dfc927c.tar.bz2 rneovim-0cfd4fa8f3dc2241de5f69d5c52510542dfc927c.zip | |
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.
Diffstat (limited to 'src/nvim/testdir/test_edit.vim')
| -rw-r--r-- | src/nvim/testdir/test_edit.vim | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/src/nvim/testdir/test_edit.vim b/src/nvim/testdir/test_edit.vim index 65194f49dd..69a34a1c51 100644 --- a/src/nvim/testdir/test_edit.vim +++ b/src/nvim/testdir/test_edit.vim @@ -420,16 +420,49 @@ func Test_edit_13() call assert_equal("", getline(2)) call assert_equal(" baz", getline(3)) set autoindent& + + " pressing <C-U> to erase line should keep the indent with 'autoindent' + set backspace=2 autoindent + %d + exe "normal i\tone\<CR>three\<C-U>two" + call assert_equal(["\tone", "\ttwo"], getline(1, '$')) + set backspace& autoindent& + bwipe! endfunc +" Test for autoindent removing indent when insert mode is stopped. Some parts +" of the code is exercised only when interactive mode is used. So use Vim in a +" terminal. +func Test_autoindent_remove_indent() + CheckRunVimInTerminal + let buf = RunVimInTerminal('-N Xfile', {'rows': 6, 'cols' : 20}) + call TermWait(buf) + call term_sendkeys(buf, ":set autoindent\n") + " leaving insert mode in a new line with indent added by autoindent, should + " remove the indent. + call term_sendkeys(buf, "i\<Tab>foo\<CR>\<Esc>") + " Need to delay for sometime, otherwise the code in getchar.c will not be + " exercised. + call TermWait(buf, 50) + " when a line is wrapped and the cursor is at the start of the second line, + " leaving insert mode, should move the cursor back to the first line. + call term_sendkeys(buf, "o" .. repeat('x', 20) .. "\<Esc>") + " Need to delay for sometime, otherwise the code in getchar.c will not be + " exercised. + call TermWait(buf, 50) + call term_sendkeys(buf, ":w\n") + call TermWait(buf) + call StopVimInTerminal(buf) + call assert_equal(["\tfoo", '', repeat('x', 20)], readfile('Xfile')) + call delete('Xfile') +endfunc + func Test_edit_CR() " Test for <CR> in insert mode " basically only in quickfix mode ist tested, the rest " has been taken care of by other tests - if !has("quickfix") - return - endif + CheckFeature quickfix botright new call writefile(range(1, 10), 'Xqflist.txt') call setqflist([{'filename': 'Xqflist.txt', 'lnum': 2}]) |