diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-03-10 07:48:13 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-03-10 07:48:13 +0100 |
commit | 1671f4488105ee12a6a8558ae351436c26ab55fc (patch) | |
tree | 2e6bd3ba9c7cb5a443d97c03bc82046ff3ce087c /src/testdir/test_edit.vim | |
parent | 5269bd2a724fdb8c16c9635ef744a670f1bc8bd5 (diff) |
patch 8.2.0369: various Normal mode commands not fully testedv8.2.0369
Problem: Various Normal mode commands not fully tested.
Solution: Add more tests. (Yegappan Lakshmanan, closes #5751)
Diffstat (limited to 'src/testdir/test_edit.vim')
-rw-r--r-- | src/testdir/test_edit.vim | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/src/testdir/test_edit.vim b/src/testdir/test_edit.vim index 9d2d0f34ac..b2d41990fc 100644 --- a/src/testdir/test_edit.vim +++ b/src/testdir/test_edit.vim @@ -281,7 +281,7 @@ func Test_edit_11() call cursor(2, 1) call feedkeys("i\<c-f>int c;\<esc>", 'tnix') call cursor(3, 1) - call feedkeys("i/* comment */", 'tnix') + call feedkeys("\<Insert>/* comment */", 'tnix') call assert_equal(['{', "\<tab>int c;", "/* comment */"], getline(1, '$')) " added changed cindentkeys slightly set cindent cinkeys+=*/ @@ -1267,16 +1267,6 @@ func Test_edit_forbidden() catch /^Vim\%((\a\+)\)\=:E117/ " catch E117: unknown function endtry au! InsertCharPre - " Not allowed to enter ex mode when text is locked - au InsertCharPre <buffer> :normal! gQ<CR> - let caught_e523 = 0 - try - call feedkeys("ix\<esc>", 'xt') - catch /^Vim\%((\a\+)\)\=:E523/ " catch E523 - let caught_e523 = 1 - endtry - call assert_equal(1, caught_e523) - au! InsertCharPre " 3) edit when completion is shown fun! Complete(findstart, base) if a:findstart @@ -1550,4 +1540,36 @@ func Test_edit_noesckeys() set esckeys endfunc +" Test for running an invalid ex command in insert mode using CTRL-O +" Note that vim has a hard-coded sleep of 3 seconds. So this test will take +" more than 3 seconds to complete. +func Test_edit_ctrl_o_invalid_cmd() + new + set showmode showcmd + let caught_e492 = 0 + try + call feedkeys("i\<C-O>:invalid\<CR>abc\<Esc>", "xt") + catch /E492:/ + let caught_e492 = 1 + endtry + call assert_equal(1, caught_e492) + call assert_equal('abc', getline(1)) + set showmode& showcmd& + close! +endfunc + +" Test for inserting text at the beginning of a line +func Test_insert_before_first_nonblank() + new + call setline(1, ' ') + normal! Ia + call assert_equal(' a', getline(1)) + set cpo+=H + call setline(1, ' ') + normal! Ia + call assert_equal(' a ', getline(1)) + set cpo-=H + close! +endfunc + " vim: shiftwidth=2 sts=2 expandtab |