comparison src/testdir/test_edit.vim @ 19625:f70a3c1000bb v8.2.0369

patch 8.2.0369: various Normal mode commands not fully tested Commit: https://github.com/vim/vim/commit/1671f4488105ee12a6a8558ae351436c26ab55fc Author: Bram Moolenaar <Bram@vim.org> Date: Tue Mar 10 07:48:13 2020 +0100 patch 8.2.0369: various Normal mode commands not fully tested Problem: Various Normal mode commands not fully tested. Solution: Add more tests. (Yegappan Lakshmanan, closes https://github.com/vim/vim/issues/5751)
author Bram Moolenaar <Bram@vim.org>
date Tue, 10 Mar 2020 08:00:06 +0100
parents 9c15be376631
children 0208534b8a84
comparison
equal deleted inserted replaced
19624:ce4838c19ca1 19625:f70a3c1000bb
279 set cindent 279 set cindent
280 call setline(1, ['{', '', '']) 280 call setline(1, ['{', '', ''])
281 call cursor(2, 1) 281 call cursor(2, 1)
282 call feedkeys("i\<c-f>int c;\<esc>", 'tnix') 282 call feedkeys("i\<c-f>int c;\<esc>", 'tnix')
283 call cursor(3, 1) 283 call cursor(3, 1)
284 call feedkeys("i/* comment */", 'tnix') 284 call feedkeys("\<Insert>/* comment */", 'tnix')
285 call assert_equal(['{', "\<tab>int c;", "/* comment */"], getline(1, '$')) 285 call assert_equal(['{', "\<tab>int c;", "/* comment */"], getline(1, '$'))
286 " added changed cindentkeys slightly 286 " added changed cindentkeys slightly
287 set cindent cinkeys+=*/ 287 set cindent cinkeys+=*/
288 call setline(1, ['{', '', '']) 288 call setline(1, ['{', '', ''])
289 call cursor(2, 1) 289 call cursor(2, 1)
1264 try 1264 try
1265 call feedkeys("ix\<esc>", 'tnix') 1265 call feedkeys("ix\<esc>", 'tnix')
1266 call assert_fails(1, 'unknown function') 1266 call assert_fails(1, 'unknown function')
1267 catch /^Vim\%((\a\+)\)\=:E117/ " catch E117: unknown function 1267 catch /^Vim\%((\a\+)\)\=:E117/ " catch E117: unknown function
1268 endtry 1268 endtry
1269 au! InsertCharPre
1270 " Not allowed to enter ex mode when text is locked
1271 au InsertCharPre <buffer> :normal! gQ<CR>
1272 let caught_e523 = 0
1273 try
1274 call feedkeys("ix\<esc>", 'xt')
1275 catch /^Vim\%((\a\+)\)\=:E523/ " catch E523
1276 let caught_e523 = 1
1277 endtry
1278 call assert_equal(1, caught_e523)
1279 au! InsertCharPre 1269 au! InsertCharPre
1280 " 3) edit when completion is shown 1270 " 3) edit when completion is shown
1281 fun! Complete(findstart, base) 1271 fun! Complete(findstart, base)
1282 if a:findstart 1272 if a:findstart
1283 return col('.') 1273 return col('.')
1548 1538
1549 bwipe! 1539 bwipe!
1550 set esckeys 1540 set esckeys
1551 endfunc 1541 endfunc
1552 1542
1543 " Test for running an invalid ex command in insert mode using CTRL-O
1544 " Note that vim has a hard-coded sleep of 3 seconds. So this test will take
1545 " more than 3 seconds to complete.
1546 func Test_edit_ctrl_o_invalid_cmd()
1547 new
1548 set showmode showcmd
1549 let caught_e492 = 0
1550 try
1551 call feedkeys("i\<C-O>:invalid\<CR>abc\<Esc>", "xt")
1552 catch /E492:/
1553 let caught_e492 = 1
1554 endtry
1555 call assert_equal(1, caught_e492)
1556 call assert_equal('abc', getline(1))
1557 set showmode& showcmd&
1558 close!
1559 endfunc
1560
1561 " Test for inserting text at the beginning of a line
1562 func Test_insert_before_first_nonblank()
1563 new
1564 call setline(1, ' ')
1565 normal! Ia
1566 call assert_equal(' a', getline(1))
1567 set cpo+=H
1568 call setline(1, ' ')
1569 normal! Ia
1570 call assert_equal(' a ', getline(1))
1571 set cpo-=H
1572 close!
1573 endfunc
1574
1553 " vim: shiftwidth=2 sts=2 expandtab 1575 " vim: shiftwidth=2 sts=2 expandtab