From 6c731d33f6729a272c5168d040ee4b86942c599b Mon Sep 17 00:00:00 2001 From: ckelsel Date: Thu, 21 Dec 2017 18:31:26 +0800 Subject: vim-patch:8.0.0314: getcmd*() functions are not tested Problem: getcmdtype(), getcmdpos() and getcmdline() are not tested. Solution: Add tests. (Yegappan Lakshmanan) https://github.com/vim/vim/commit/65189a1294307abf007faab7385dc0145ba72b06 --- src/nvim/testdir/test_cmdline.vim | 32 ++++++++++++++++++++++++++++++++ src/nvim/version.c | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/testdir/test_cmdline.vim b/src/nvim/testdir/test_cmdline.vim index ac44e09a5a..dc9790a39c 100644 --- a/src/nvim/testdir/test_cmdline.vim +++ b/src/nvim/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/nvim/version.c b/src/nvim/version.c index 8ab9fc1a4b..26e15e3b15 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -942,7 +942,7 @@ static const int included_patches[] = { // 317, // 316, // 315, - // 314, + 314, // 313, // 312, 311, -- cgit From eb95b88156aa7ee022db4cf5d48656c1b5fd5a06 Mon Sep 17 00:00:00 2001 From: ckelsel Date: Thu, 21 Dec 2017 18:40:40 +0800 Subject: vim-patch:8.0.0315: :help :[range] does not work Problem: ":help :[range]" does not work. (Tony Mechelynck) Solution: Translate to insert a backslash. https://github.com/vim/vim/commit/a76f59d817e2da31d83b4f0e978b52abe81e0ae9 --- src/nvim/ex_cmds.c | 6 ++++-- src/nvim/version.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 8616508d88..7188be5407 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -4619,7 +4619,8 @@ int find_help_tags(char_u *arg, int *num_matches, char_u ***matches, int keep_la "/\\(\\)", "/\\%(\\)", "?", ":?", "?", "g?", "g?g?", "g??", "z?", "/\\?", "/\\z(\\)", "\\=", ":s\\=", - "[count]", "[quotex]", "[range]", + "[count]", "[quotex]", + "[range]", ":[range]", "[pattern]", "\\|", "\\%$", "s/\\~", "s/\\U", "s/\\L", "s/\\1", "s/\\2", "s/\\3", "s/\\9"}; @@ -4628,7 +4629,8 @@ int find_help_tags(char_u *arg, int *num_matches, char_u ***matches, int keep_la "/\\\\(\\\\)", "/\\\\%(\\\\)", "?", ":?", "?", "g?", "g?g?", "g??", "z?", "/\\\\?", "/\\\\z(\\\\)", "\\\\=", ":s\\\\=", - "\\[count]", "\\[quotex]", "\\[range]", + "\\[count]", "\\[quotex]", + "\\[range]", ":\\[range]", "\\[pattern]", "\\\\bar", "/\\\\%\\$", "s/\\\\\\~", "s/\\\\U", "s/\\\\L", "s/\\\\1", "s/\\\\2", "s/\\\\3", "s/\\\\9"}; diff --git a/src/nvim/version.c b/src/nvim/version.c index 26e15e3b15..d511ccb0d6 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -941,7 +941,7 @@ static const int included_patches[] = { // 318, // 317, // 316, - // 315, + 315, 314, // 313, // 312, -- cgit