diff options
author | Bram Moolenaar <Bram@vim.org> | 2017-02-06 22:22:17 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2017-02-06 22:22:17 +0100 |
commit | 65189a1294307abf007faab7385dc0145ba72b06 (patch) | |
tree | f9043c170d9f7fa7acfb589cfb2c97ade0bb7adf | |
parent | 6f785749db766205616fcf8438f43d1859d8f5e4 (diff) | |
download | vim-git-65189a1294307abf007faab7385dc0145ba72b06.tar.gz |
patch 8.0.0314: getcmd*() functions are not testedv8.0.0314
Problem: getcmdtype(), getcmdpos() and getcmdline() are not tested.
Solution: Add tests. (Yegappan Lakshmanan)
-rw-r--r-- | src/testdir/test_cmdline.vim | 32 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 34 insertions, 0 deletions
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim index aa8fb13c6..0a5c91009 100644 --- a/src/testdir/test_cmdline.vim +++ b/src/testdir/test_cmdline.vim @@ -330,4 +330,36 @@ func Test_cmdline_search_range() bwipe! 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& diff --git a/src/version.c b/src/version.c index 261a55d22..4da417b92 100644 --- a/src/version.c +++ b/src/version.c @@ -765,6 +765,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 314, +/**/ 313, /**/ 312, |