0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

patch 8.0.1816: no test for setcmdpos()

Problem:    No test for setcmdpos().
Solution:   Add a test. (Dominique Pelle, closes #2901)
This commit is contained in:
Bram Moolenaar
2018-05-12 13:18:46 +02:00
parent 0cb8ac71ae
commit ff3be4fe1e
2 changed files with 23 additions and 0 deletions

View File

@@ -470,4 +470,25 @@ func Test_verbosefile()
call delete('Xlog') call delete('Xlog')
endfunc endfunc
func Test_setcmdpos()
func InsertTextAtPos(text, pos)
call assert_equal(0, setcmdpos(a:pos))
return a:text
endfunc
" setcmdpos() with position in the middle of the command line.
call feedkeys(":\"12\<C-R>=InsertTextAtPos('a', 3)\<CR>b\<CR>", 'xt')
call assert_equal('"1ab2', @:)
call feedkeys(":\"12\<C-R>\<C-R>=InsertTextAtPos('a', 3)\<CR>b\<CR>", 'xt')
call assert_equal('"1b2a', @:)
" setcmdpos() with position beyond the end of the command line.
call feedkeys(":\"12\<C-B>\<C-R>=InsertTextAtPos('a', 10)\<CR>b\<CR>", 'xt')
call assert_equal('"12ab', @:)
" setcmdpos() returns 1 when not editing the command line.
call assert_equal(1, setcmdpos(3))
endfunc
set cpo& set cpo&

View File

@@ -761,6 +761,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 */
/**/
1816,
/**/ /**/
1815, 1815,
/**/ /**/