diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-02-16 13:33:56 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-02-16 13:33:56 +0100 |
commit | f0cee1971f5258ce61f8a4e6a04d35c1e625bb01 (patch) | |
tree | 1d705533ffe8c6be585b26095c7ef593f784cd69 /src/testdir/test_cmdline.vim | |
parent | f4140488c72cad4dbf5449dba099cfa7de7bbb22 (diff) |
patch 8.2.0261: some code not covered by testsv8.2.0261
Problem: Some code not covered by tests.
Solution: Add test cases. (Yegappan Lakshmanan, closes #5645)
Diffstat (limited to 'src/testdir/test_cmdline.vim')
-rw-r--r-- | src/testdir/test_cmdline.vim | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim index 27ebfbcda1..ff15cbbe3b 100644 --- a/src/testdir/test_cmdline.vim +++ b/src/testdir/test_cmdline.vim @@ -632,9 +632,32 @@ func Test_cmdline_search_range() 1,\&s/b/B/ call assert_equal('B', getline(2)) + let @/ = 'apple' + call assert_fails('\/print', 'E486:') + bwipe! endfunc +" Test for the tick mark (') in an excmd range +func Test_tick_mark_in_range() + " If only the tick is passed as a range and no command is specified, there + " should not be an error + call feedkeys(":'\<CR>", 'xt') + call assert_equal("'", getreg(':')) + call assert_fails("',print", 'E78:') +endfunc + +" Test for using a line number followed by a search pattern as range +func Test_lnum_and_pattern_as_range() + new + call setline(1, ['foo 1', 'foo 2', 'foo 3']) + let @" = '' + 2/foo/yank + call assert_equal("foo 3\n", @") + call assert_equal(1, line('.')) + close! +endfunc + " Tests for getcmdline(), getcmdpos() and getcmdtype() func Check_cmdline(cmdtype) call assert_equal('MyCmd a', getcmdline()) @@ -934,4 +957,24 @@ func Test_cmdline_expand_special() call assert_fails('e <amatch>', 'E497:') endfunc +func Test_cmdwin_jump_to_win() + call assert_fails('call feedkeys("q:\<C-W>\<C-W>\<CR>", "xt")', 'E11:') + new + set modified + call assert_fails('call feedkeys("q/:qall\<CR>", "xt")', 'E162:') + close! + call feedkeys("q/:close\<CR>", "xt") + call assert_equal(1, winnr('$')) + call feedkeys("q/:exit\<CR>", "xt") + call assert_equal(1, winnr('$')) +endfunc + +" Test for backtick expression in the command line +func Test_cmd_backtick() + %argd + argadd `=['a', 'b', 'c']` + call assert_equal(['a', 'b', 'c'], argv()) + %argd +endfunc + " vim: shiftwidth=2 sts=2 expandtab |