diff options
| author | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-08-16 12:16:17 -0400 | 
|---|---|---|
| committer | Jan Edmund Lazo <janedmundlazo@hotmail.com> | 2018-08-16 12:30:15 -0400 | 
| commit | 14b148f0adbdb339d98ae293929949bffa7fa94b (patch) | |
| tree | c537a49f6b65debd2a51b398c59a7f517efecc33 | |
| parent | 1dcdac013e4beea2a327e1fb98ac4627bbe174ec (diff) | |
| download | rneovim-14b148f0adbdb339d98ae293929949bffa7fa94b.tar.gz rneovim-14b148f0adbdb339d98ae293929949bffa7fa94b.tar.bz2 rneovim-14b148f0adbdb339d98ae293929949bffa7fa94b.zip  | |
vim-patch:8.0.1816: no test for setcmdpos()
Problem:    No test for setcmdpos().
Solution:   Add a test. (Dominique Pelle, closes vim/vim#2901)
https://github.com/vim/vim/commit/ff3be4fe1e2e723de48b826cb992c798e296c41e
| -rw-r--r-- | src/nvim/testdir/test_cmdline.vim | 21 | 
1 files changed, 21 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim index 9ea80d73d4..02c44ee6cb 100644 --- a/src/nvim/testdir/test_cmdline.vim +++ b/src/nvim/testdir/test_cmdline.vim @@ -471,4 +471,25 @@ func Test_verbosefile()    call delete('Xlog')  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&  | 
