mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.0.0314: getcmd*() functions are not tested
Problem: getcmdtype(), getcmdpos() and getcmdline() are not tested. Solution: Add tests. (Yegappan Lakshmanan)
This commit is contained in:
@@ -330,4 +330,36 @@ func Test_cmdline_search_range()
|
|||||||
bwipe!
|
bwipe!
|
||||||
endfunc
|
endfunc
|
||||||
|
|
||||||
|
" Tests for getcmdline(), getcmdpos() and getcmdtype()
|
||||||
|
func Check_cmdline(cmdtype)
|
||||||
|
call assert_equal('MyCmd a', getcmdline())
|
||||||
|
call assert_equal(8, getcmdpos())
|
||||||
|
call assert_equal(a:cmdtype, getcmdtype())
|
||||||
|
return ''
|
||||||
|
endfunc
|
||||||
|
|
||||||
|
func Test_getcmdtype()
|
||||||
|
call feedkeys(":MyCmd a\<C-R>=Check_cmdline(':')\<CR>\<Esc>", "xt")
|
||||||
|
|
||||||
|
let cmdtype = ''
|
||||||
|
debuggreedy
|
||||||
|
call feedkeys(":debug echo 'test'\<CR>", "t")
|
||||||
|
call feedkeys("let cmdtype = \<C-R>=string(getcmdtype())\<CR>\<CR>", "t")
|
||||||
|
call feedkeys("cont\<CR>", "xt")
|
||||||
|
0debuggreedy
|
||||||
|
call assert_equal('>', cmdtype)
|
||||||
|
|
||||||
|
call feedkeys("/MyCmd a\<C-R>=Check_cmdline('/')\<CR>\<Esc>", "xt")
|
||||||
|
call feedkeys("?MyCmd a\<C-R>=Check_cmdline('?')\<CR>\<Esc>", "xt")
|
||||||
|
|
||||||
|
call feedkeys(":call input('Answer?')\<CR>", "t")
|
||||||
|
call feedkeys("MyCmd a\<C-R>=Check_cmdline('@')\<CR>\<Esc>", "xt")
|
||||||
|
|
||||||
|
call feedkeys(":insert\<CR>MyCmd a\<C-R>=Check_cmdline('-')\<CR>\<Esc>", "xt")
|
||||||
|
|
||||||
|
cnoremap <expr> <F6> Check_cmdline('=')
|
||||||
|
call feedkeys("a\<C-R>=MyCmd a\<F6>\<Esc>\<Esc>", "xt")
|
||||||
|
cunmap <F6>
|
||||||
|
endfunc
|
||||||
|
|
||||||
set cpo&
|
set cpo&
|
||||||
|
@@ -764,6 +764,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
314,
|
||||||
/**/
|
/**/
|
||||||
313,
|
313,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user