# HG changeset patch # User Christian Brabandt # Date 1486416603 -3600 # Node ID 6ae12eba42b58a9c11810d995e23304af45f5dd7 # Parent 39f7b3170883693ac47ba58a764ffa57d2b203e9 patch 8.0.0314: getcmd*() functions are not tested commit https://github.com/vim/vim/commit/65189a1294307abf007faab7385dc0145ba72b06 Author: Bram Moolenaar Date: Mon Feb 6 22:22:17 2017 +0100 patch 8.0.0314: getcmd*() functions are not tested Problem: getcmdtype(), getcmdpos() and getcmdline() are not tested. Solution: Add tests. (Yegappan Lakshmanan) diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim --- 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\=Check_cmdline(':')\\", "xt") + + let cmdtype = '' + debuggreedy + call feedkeys(":debug echo 'test'\", "t") + call feedkeys("let cmdtype = \=string(getcmdtype())\\", "t") + call feedkeys("cont\", "xt") + 0debuggreedy + call assert_equal('>', cmdtype) + + call feedkeys("/MyCmd a\=Check_cmdline('/')\\", "xt") + call feedkeys("?MyCmd a\=Check_cmdline('?')\\", "xt") + + call feedkeys(":call input('Answer?')\", "t") + call feedkeys("MyCmd a\=Check_cmdline('@')\\", "xt") + + call feedkeys(":insert\MyCmd a\=Check_cmdline('-')\\", "xt") + + cnoremap Check_cmdline('=') + call feedkeys("a\=MyCmd a\\\", "xt") + cunmap +endfunc + set cpo& diff --git a/src/version.c b/src/version.c --- 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,