1
0
forked from aniani/vim

patch 8.2.0261: some code not covered by tests

Problem:    Some code not covered by tests.
Solution:   Add test cases. (Yegappan Lakshmanan, closes #5645)
This commit is contained in:
Bram Moolenaar
2020-02-16 13:33:56 +01:00
parent f4140488c7
commit f0cee1971f
11 changed files with 223 additions and 0 deletions

View File

@@ -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