0
0
mirror of https://github.com/vim/vim.git synced 2025-10-04 05:25:06 -04:00

patch 8.2.0293: various Ex commands not sufficiently tested

Problem:    Various Ex commands not sufficiently tested.
Solution:   Add more test cases. (Yegappan Lakshmanan, closes #5673)
This commit is contained in:
Bram Moolenaar
2020-02-21 17:54:45 +01:00
parent 09f28f49c9
commit 818fc9ad14
14 changed files with 198 additions and 7 deletions

View File

@@ -349,6 +349,44 @@ func Test_run_excmd_with_text_locked()
let cmd = ":\<C-\>eexecute('close')\<CR>\<C-C>"
call assert_equal(2, winnr('$'))
close
call assert_fails("call feedkeys(\":\<C-R>=execute('bnext')\<CR>\", 'xt')", 'E523:')
endfunc
" Test for the :verbose command
func Test_verbose_cmd()
call assert_equal([' verbose=1'], split(execute('verbose set vbs'), "\n"))
call assert_equal([' verbose=0'], split(execute('0verbose set vbs'), "\n"))
let l = execute("4verbose set verbose | set verbose")
call assert_equal([' verbose=4', ' verbose=0'], split(l, "\n"))
endfunc
" Test for the :delete command and the related abbreviated commands
func Test_excmd_delete()
new
call setline(1, ['foo', "\tbar"])
call assert_equal(['^Ibar$'], split(execute('dl'), "\n"))
call setline(1, ['foo', "\tbar"])
call assert_equal(['^Ibar$'], split(execute('dell'), "\n"))
call setline(1, ['foo', "\tbar"])
call assert_equal(['^Ibar$'], split(execute('delel'), "\n"))
call setline(1, ['foo', "\tbar"])
call assert_equal(['^Ibar$'], split(execute('deletl'), "\n"))
call setline(1, ['foo', "\tbar"])
call assert_equal(['^Ibar$'], split(execute('deletel'), "\n"))
call setline(1, ['foo', "\tbar"])
call assert_equal([' bar'], split(execute('dp'), "\n"))
call setline(1, ['foo', "\tbar"])
call assert_equal([' bar'], split(execute('dep'), "\n"))
call setline(1, ['foo', "\tbar"])
call assert_equal([' bar'], split(execute('delp'), "\n"))
call setline(1, ['foo', "\tbar"])
call assert_equal([' bar'], split(execute('delep'), "\n"))
call setline(1, ['foo', "\tbar"])
call assert_equal([' bar'], split(execute('deletp'), "\n"))
call setline(1, ['foo', "\tbar"])
call assert_equal([' bar'], split(execute('deletep'), "\n"))
close!
endfunc
" vim: shiftwidth=2 sts=2 expandtab