mirror of
https://github.com/neovim/neovim.git
synced 2025-01-02 17:33:28 -07:00
vim-patch:8.2.0270: some code not covered by tests
Problem: Some code not covered by tests.
Solution: Add test cases. (Yegappan Lakshmanan, closes vim/vim#5649)
bc2b71d44a
This commit is contained in:
parent
6a670a00b3
commit
d079995fb8
@ -105,9 +105,9 @@ func Test_buflist_browse()
|
||||
call assert_equal(b2, bufnr())
|
||||
call assert_equal(1, line('.'))
|
||||
|
||||
brewind +/foo3
|
||||
brewind +
|
||||
call assert_equal(b1, bufnr())
|
||||
call assert_equal(3, line('.'))
|
||||
call assert_equal(4, line('.'))
|
||||
|
||||
blast +/baz2
|
||||
call assert_equal(b3, bufnr())
|
||||
|
@ -1617,6 +1617,22 @@ func Test_edit_startinsert()
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" Test for :startreplace and :startgreplace
|
||||
func Test_edit_startreplace()
|
||||
new
|
||||
call setline(1, 'abc')
|
||||
call feedkeys("l:startreplace\<CR>xyz\e", 'xt')
|
||||
call assert_equal('axyz', getline(1))
|
||||
call feedkeys("0:startreplace!\<CR>abc\e", 'xt')
|
||||
call assert_equal('axyzabc', getline(1))
|
||||
call setline(1, "a\tb")
|
||||
call feedkeys("0l:startgreplace\<CR>xyz\e", 'xt')
|
||||
call assert_equal("axyz\tb", getline(1))
|
||||
call feedkeys("0i\<C-R>=execute('startreplace')\<CR>12\e", 'xt')
|
||||
call assert_equal("12axyz\tb", getline(1))
|
||||
close!
|
||||
endfunc
|
||||
|
||||
func Test_edit_noesckeys()
|
||||
CheckNotGui
|
||||
new
|
||||
|
@ -64,7 +64,7 @@ func Test_ex_mode()
|
||||
let &encoding = encoding_save
|
||||
endfunc
|
||||
|
||||
" Test subsittute confirmation prompt :%s/pat/str/c in Ex mode
|
||||
" Test substitute confirmation prompt :%s/pat/str/c in Ex mode
|
||||
func Test_Ex_substitute()
|
||||
CheckRunVimInTerminal
|
||||
let buf = RunVimInTerminal('', {'rows': 6})
|
||||
@ -86,6 +86,11 @@ func Test_Ex_substitute()
|
||||
call term_sendkeys(buf, "q\<CR>")
|
||||
call WaitForAssert({-> assert_match(':', term_getline(buf, 6))}, 1000)
|
||||
|
||||
" Pressing enter in ex mode should print the current line
|
||||
call term_sendkeys(buf, "\<CR>")
|
||||
call WaitForAssert({-> assert_match(' 3 foo foo',
|
||||
\ term_getline(buf, 5))}, 1000)
|
||||
|
||||
call term_sendkeys(buf, ":vi\<CR>")
|
||||
call WaitForAssert({-> assert_match('foo bar', term_getline(buf, 1))}, 1000)
|
||||
|
||||
|
@ -437,6 +437,16 @@ func Test_redir_cmd()
|
||||
call assert_fails('redir! > Xfile', 'E190:')
|
||||
call delete('Xfile')
|
||||
endif
|
||||
|
||||
" Test for redirecting to a register
|
||||
redir @q> | echon 'clean ' | redir END
|
||||
redir @q>> | echon 'water' | redir END
|
||||
call assert_equal('clean water', @q)
|
||||
|
||||
" Test for redirecting to a variable
|
||||
redir => color | echon 'blue ' | redir END
|
||||
redir =>> color | echon 'sky' | redir END
|
||||
call assert_equal('blue sky', color)
|
||||
endfunc
|
||||
|
||||
" Test for the :filetype command
|
||||
@ -449,6 +459,30 @@ func Test_mode_cmd()
|
||||
call assert_fails('mode abc', 'E359:')
|
||||
endfunc
|
||||
|
||||
" Test for the :sleep command
|
||||
func Test_sleep_cmd()
|
||||
call assert_fails('sleep x', 'E475:')
|
||||
endfunc
|
||||
|
||||
" Test for the :read command
|
||||
func Test_read_cmd()
|
||||
call writefile(['one'], 'Xfile')
|
||||
new
|
||||
call assert_fails('read', 'E32:')
|
||||
edit Xfile
|
||||
read
|
||||
call assert_equal(['one', 'one'], getline(1, '$'))
|
||||
close!
|
||||
new
|
||||
read Xfile
|
||||
call assert_equal(['', 'one'], getline(1, '$'))
|
||||
call deletebufline('', 1, '$')
|
||||
call feedkeys("Qr Xfile\<CR>visual\<CR>", 'xt')
|
||||
call assert_equal(['one'], getline(1, '$'))
|
||||
close!
|
||||
call delete('Xfile')
|
||||
endfunc
|
||||
|
||||
" Test for running Ex commands when text is locked.
|
||||
" <C-\>e in the command line is used to lock the text
|
||||
func Test_run_excmd_with_text_locked()
|
||||
|
@ -1,5 +1,7 @@
|
||||
" Test for expanding file names
|
||||
|
||||
source shared.vim
|
||||
|
||||
func Test_with_directories()
|
||||
call mkdir('Xdir1')
|
||||
call mkdir('Xdir2')
|
||||
@ -81,3 +83,30 @@ func Test_expandcmd()
|
||||
call assert_fails('call expandcmd("make %")', 'E499:')
|
||||
close
|
||||
endfunc
|
||||
|
||||
" Test for expanding <sfile>, <slnum> and <sflnum> outside of sourcing a script
|
||||
func Test_source_sfile()
|
||||
let lines =<< trim [SCRIPT]
|
||||
:call assert_fails('echo expandcmd("<sfile>")', 'E498:')
|
||||
:call assert_fails('echo expandcmd("<slnum>")', 'E842:')
|
||||
:call assert_fails('echo expandcmd("<sflnum>")', 'E961:')
|
||||
:call assert_fails('call expandcmd("edit <cfile>")', 'E446:')
|
||||
:call assert_fails('call expandcmd("edit #")', 'E194:')
|
||||
:call assert_fails('call expandcmd("edit #<2")', 'E684:')
|
||||
:call assert_fails('call expandcmd("edit <cword>")', 'E348:')
|
||||
:call assert_fails('call expandcmd("edit <cexpr>")', 'E348:')
|
||||
:call assert_fails('autocmd User MyCmd echo "<sfile>"', 'E498:')
|
||||
:call writefile(v:errors, 'Xresult')
|
||||
:qall!
|
||||
|
||||
[SCRIPT]
|
||||
call writefile(lines, 'Xscript')
|
||||
if RunVim([], [], '--clean -s Xscript')
|
||||
call assert_equal([], readfile('Xresult'))
|
||||
endif
|
||||
call delete('Xscript')
|
||||
call delete('Xresult')
|
||||
endfunc
|
||||
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
@ -757,6 +757,26 @@ func Test_setfiletype_completion()
|
||||
call assert_equal('"setfiletype java javacc javascript javascriptreact', @:)
|
||||
endfunc
|
||||
|
||||
" Test for ':filetype detect' command for a buffer without a file
|
||||
func Test_emptybuf_ftdetect()
|
||||
new
|
||||
call setline(1, '#!/bin/sh')
|
||||
call assert_equal('', &filetype)
|
||||
filetype detect
|
||||
call assert_equal('sh', &filetype)
|
||||
close!
|
||||
endfunc
|
||||
|
||||
" Test for ':filetype indent on' and ':filetype indent off' commands
|
||||
func Test_filetype_indent_off()
|
||||
new Xtest.vim
|
||||
filetype indent on
|
||||
call assert_equal(1, g:did_indent_on)
|
||||
filetype indent off
|
||||
call assert_equal(0, exists('g:did_indent_on'))
|
||||
close
|
||||
endfunc
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" Tests for specific extensions and filetypes.
|
||||
" Keep sorted.
|
||||
|
@ -193,12 +193,14 @@ func Test_find_cmd()
|
||||
set path=.,./**/*
|
||||
call CreateFiles()
|
||||
cd Xdir1
|
||||
|
||||
" Test for :find
|
||||
find foo
|
||||
call assert_equal('foo', expand('%:.'))
|
||||
2find foo
|
||||
call assert_equal('Xdir2/foo', expand('%:.'))
|
||||
call assert_fails('3find foo', 'E347:')
|
||||
|
||||
" Test for :sfind
|
||||
enew
|
||||
sfind barfoo
|
||||
@ -207,6 +209,7 @@ func Test_find_cmd()
|
||||
close
|
||||
call assert_fails('sfind baz', 'E345:')
|
||||
call assert_equal(2, winnr('$'))
|
||||
|
||||
" Test for :tabfind
|
||||
enew
|
||||
tabfind foobar
|
||||
@ -215,7 +218,8 @@ func Test_find_cmd()
|
||||
tabclose
|
||||
call assert_fails('tabfind baz', 'E345:')
|
||||
call assert_equal(1, tabpagenr('$'))
|
||||
" call chdir(save_dir)
|
||||
|
||||
call chdir(save_dir)
|
||||
exe 'cd ' . save_dir
|
||||
call CleanFiles()
|
||||
let &path = save_path
|
||||
|
@ -437,5 +437,11 @@ func Test_join_lines()
|
||||
call setline(1, ['a', 'b', '', 'c', 'd'])
|
||||
normal 5J
|
||||
call assert_equal('a b c d', getline(1))
|
||||
call setline(1, ['a', 'b', 'c'])
|
||||
2,2join
|
||||
call assert_equal(['a', 'b', 'c'], getline(1, '$'))
|
||||
call assert_equal(2, line('.'))
|
||||
2join
|
||||
call assert_equal(['a', 'b c'], getline(1, '$'))
|
||||
bwipe!
|
||||
endfunc
|
||||
|
@ -38,6 +38,7 @@ func Test_move()
|
||||
call assert_fails("move -100", 'E16:')
|
||||
call assert_fails("move +100", 'E16:')
|
||||
call assert_fails('move', 'E16:')
|
||||
call assert_fails("move 'r", 'E20:')
|
||||
|
||||
%bwipeout!
|
||||
endfunc
|
||||
|
@ -416,6 +416,17 @@ func Test_put_reg_restart_mode()
|
||||
bwipe!
|
||||
endfunc
|
||||
|
||||
" Test for executing a register using :@ command
|
||||
func Test_execute_register()
|
||||
call setreg('r', [])
|
||||
call assert_beeps('@r')
|
||||
let i = 1
|
||||
let @q = 'let i+= 1'
|
||||
@q
|
||||
@
|
||||
call assert_equal(3, i)
|
||||
endfunc
|
||||
|
||||
" Test for getting register info
|
||||
func Test_get_reginfo()
|
||||
enew
|
||||
|
@ -66,4 +66,25 @@ func Test_source_ignore_shebang()
|
||||
call delete('Xfile.vim')
|
||||
endfunc
|
||||
|
||||
" Test for expanding <sfile> in a autocmd and for <slnum> and <sflnum>
|
||||
func Test_source_autocmd_sfile()
|
||||
let code =<< trim [CODE]
|
||||
let g:SfileName = ''
|
||||
augroup sfiletest
|
||||
au!
|
||||
autocmd User UserAutoCmd let g:Sfile = '<sfile>:t'
|
||||
augroup END
|
||||
doautocmd User UserAutoCmd
|
||||
let g:Slnum = expand('<slnum>')
|
||||
let g:Sflnum = expand('<sflnum>')
|
||||
augroup! sfiletest
|
||||
[CODE]
|
||||
call writefile(code, 'Xscript.vim')
|
||||
source Xscript.vim
|
||||
call assert_equal('Xscript.vim', g:Sfile)
|
||||
call assert_equal('7', g:Slnum)
|
||||
call assert_equal('8', g:Sflnum)
|
||||
call delete('Xscript.vim')
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
@ -139,7 +139,11 @@ function Test_tabpage()
|
||||
call assert_fails("tabmove -99", 'E474:')
|
||||
call assert_fails("tabmove -3+", 'E474:')
|
||||
call assert_fails("tabmove $3", 'E474:')
|
||||
call assert_fails("%tabonly", 'E16:')
|
||||
1tabonly!
|
||||
tabnew
|
||||
call assert_fails("-2tabmove", 'E474:')
|
||||
tabonly!
|
||||
endfunc
|
||||
|
||||
" Test autocommands
|
||||
@ -607,6 +611,16 @@ func Test_tabpage_cmdheight()
|
||||
call delete('XTest_tabpage_cmdheight')
|
||||
endfunc
|
||||
|
||||
" Test for closing the tab page from a command window
|
||||
func Test_tabpage_close_cmdwin()
|
||||
tabnew
|
||||
call feedkeys("q/:tabclose\<CR>\<Esc>", 'xt')
|
||||
call assert_equal(2, tabpagenr('$'))
|
||||
call feedkeys("q/:tabonly\<CR>\<Esc>", 'xt')
|
||||
call assert_equal(2, tabpagenr('$'))
|
||||
tabonly
|
||||
endfunc
|
||||
|
||||
" Return the terminal key code for selecting a tab page from the tabline. This
|
||||
" sequence contains the following codes: a CSI (0x9b), KS_TABLINE (0xf0),
|
||||
" KS_FILLER (0x58) and then the tab page number.
|
||||
|
@ -935,6 +935,11 @@ func Test_tag_multimatch()
|
||||
tag FIRST
|
||||
tnext
|
||||
call assert_equal(2, line('.'))
|
||||
tlast
|
||||
tprev
|
||||
call assert_equal(2, line('.'))
|
||||
tNext
|
||||
call assert_equal(1, line('.'))
|
||||
set ignorecase&
|
||||
|
||||
call delete('Xtags')
|
||||
@ -1077,6 +1082,202 @@ Type number and <Enter> (q or empty cancels):
|
||||
%bwipe
|
||||
endfunc
|
||||
|
||||
" Test for :isearch, :ilist, :ijump and :isplit commands
|
||||
" Test for [i, ]i, [I, ]I, [ CTRL-I, ] CTRL-I and CTRL-W i commands
|
||||
func Test_inc_search()
|
||||
new
|
||||
call setline(1, ['1:foo', '2:foo', 'foo', '3:foo', '4:foo'])
|
||||
call cursor(3, 1)
|
||||
|
||||
" Test for [i and ]i
|
||||
call assert_equal('1:foo', execute('normal [i'))
|
||||
call assert_equal('2:foo', execute('normal 2[i'))
|
||||
call assert_fails('normal 3[i', 'E387:')
|
||||
call assert_equal('3:foo', execute('normal ]i'))
|
||||
call assert_equal('4:foo', execute('normal 2]i'))
|
||||
call assert_fails('normal 3]i', 'E389:')
|
||||
|
||||
" Test for :isearch
|
||||
call assert_equal('1:foo', execute('isearch foo'))
|
||||
call assert_equal('3:foo', execute('isearch 4 /foo/'))
|
||||
call assert_fails('isearch 3 foo', 'E387:')
|
||||
call assert_equal('3:foo', execute('+1,$isearch foo'))
|
||||
call assert_fails('1,.-1isearch 3 foo', 'E389:')
|
||||
call assert_fails('isearch bar', 'E389:')
|
||||
call assert_fails('isearch /foo/3', 'E488:')
|
||||
|
||||
" Test for [I and ]I
|
||||
call assert_equal([
|
||||
\ ' 1: 1 1:foo',
|
||||
\ ' 2: 2 2:foo',
|
||||
\ ' 3: 3 foo',
|
||||
\ ' 4: 4 3:foo',
|
||||
\ ' 5: 5 4:foo'], split(execute('normal [I'), "\n"))
|
||||
call assert_equal([
|
||||
\ ' 1: 4 3:foo',
|
||||
\ ' 2: 5 4:foo'], split(execute('normal ]I'), "\n"))
|
||||
|
||||
" Test for :ilist
|
||||
call assert_equal([
|
||||
\ ' 1: 1 1:foo',
|
||||
\ ' 2: 2 2:foo',
|
||||
\ ' 3: 3 foo',
|
||||
\ ' 4: 4 3:foo',
|
||||
\ ' 5: 5 4:foo'], split(execute('ilist foo'), "\n"))
|
||||
call assert_equal([
|
||||
\ ' 1: 4 3:foo',
|
||||
\ ' 2: 5 4:foo'], split(execute('+1,$ilist /foo/'), "\n"))
|
||||
call assert_fails('ilist bar', 'E389:')
|
||||
|
||||
" Test for [ CTRL-I and ] CTRL-I
|
||||
exe "normal [\t"
|
||||
call assert_equal([1, 3], [line('.'), col('.')])
|
||||
exe "normal 2j4[\t"
|
||||
call assert_equal([4, 3], [line('.'), col('.')])
|
||||
call assert_fails("normal k3[\t", 'E387:')
|
||||
call assert_fails("normal 6[\t", 'E389:')
|
||||
exe "normal ]\t"
|
||||
call assert_equal([4, 3], [line('.'), col('.')])
|
||||
exe "normal k2]\t"
|
||||
call assert_equal([5, 3], [line('.'), col('.')])
|
||||
call assert_fails("normal 2k3]\t", 'E389:')
|
||||
|
||||
" Test for :ijump
|
||||
call cursor(3, 1)
|
||||
ijump foo
|
||||
call assert_equal([1, 3], [line('.'), col('.')])
|
||||
call cursor(3, 1)
|
||||
ijump 4 /foo/
|
||||
call assert_equal([4, 3], [line('.'), col('.')])
|
||||
call cursor(3, 1)
|
||||
call assert_fails('ijump 3 foo', 'E387:')
|
||||
+,$ijump 2 foo
|
||||
call assert_equal([5, 3], [line('.'), col('.')])
|
||||
call assert_fails('ijump bar', 'E389:')
|
||||
|
||||
" Test for CTRL-W i
|
||||
call cursor(3, 1)
|
||||
wincmd i
|
||||
call assert_equal([1, 3, 3], [line('.'), col('.'), winnr('$')])
|
||||
close
|
||||
5wincmd i
|
||||
call assert_equal([5, 3, 3], [line('.'), col('.'), winnr('$')])
|
||||
close
|
||||
call assert_fails('3wincmd i', 'E387:')
|
||||
call assert_fails('6wincmd i', 'E389:')
|
||||
|
||||
" Test for :isplit
|
||||
isplit foo
|
||||
call assert_equal([1, 3, 3], [line('.'), col('.'), winnr('$')])
|
||||
close
|
||||
isplit 5 /foo/
|
||||
call assert_equal([5, 3, 3], [line('.'), col('.'), winnr('$')])
|
||||
close
|
||||
call assert_fails('isplit 3 foo', 'E387:')
|
||||
call assert_fails('isplit 6 foo', 'E389:')
|
||||
call assert_fails('isplit bar', 'E389:')
|
||||
|
||||
close!
|
||||
endfunc
|
||||
|
||||
" Test for :dsearch, :dlist, :djump and :dsplit commands
|
||||
" Test for [d, ]d, [D, ]D, [ CTRL-D, ] CTRL-D and CTRL-W d commands
|
||||
func Test_def_search()
|
||||
new
|
||||
call setline(1, ['#define FOO 1', '#define FOO 2', '#define FOO 3',
|
||||
\ '#define FOO 4', '#define FOO 5'])
|
||||
call cursor(3, 9)
|
||||
|
||||
" Test for [d and ]d
|
||||
call assert_equal('#define FOO 1', execute('normal [d'))
|
||||
call assert_equal('#define FOO 2', execute('normal 2[d'))
|
||||
call assert_fails('normal 3[d', 'E387:')
|
||||
call assert_equal('#define FOO 4', execute('normal ]d'))
|
||||
call assert_equal('#define FOO 5', execute('normal 2]d'))
|
||||
call assert_fails('normal 3]d', 'E388:')
|
||||
|
||||
" Test for :dsearch
|
||||
call assert_equal('#define FOO 1', execute('dsearch FOO'))
|
||||
call assert_equal('#define FOO 5', execute('dsearch 5 /FOO/'))
|
||||
call assert_fails('dsearch 3 FOO', 'E387:')
|
||||
call assert_equal('#define FOO 4', execute('+1,$dsearch FOO'))
|
||||
call assert_fails('1,.-1dsearch 3 FOO', 'E388:')
|
||||
call assert_fails('dsearch BAR', 'E388:')
|
||||
|
||||
" Test for [D and ]D
|
||||
call assert_equal([
|
||||
\ ' 1: 1 #define FOO 1',
|
||||
\ ' 2: 2 #define FOO 2',
|
||||
\ ' 3: 3 #define FOO 3',
|
||||
\ ' 4: 4 #define FOO 4',
|
||||
\ ' 5: 5 #define FOO 5'], split(execute('normal [D'), "\n"))
|
||||
call assert_equal([
|
||||
\ ' 1: 4 #define FOO 4',
|
||||
\ ' 2: 5 #define FOO 5'], split(execute('normal ]D'), "\n"))
|
||||
|
||||
" Test for :dlist
|
||||
call assert_equal([
|
||||
\ ' 1: 1 #define FOO 1',
|
||||
\ ' 2: 2 #define FOO 2',
|
||||
\ ' 3: 3 #define FOO 3',
|
||||
\ ' 4: 4 #define FOO 4',
|
||||
\ ' 5: 5 #define FOO 5'], split(execute('dlist FOO'), "\n"))
|
||||
call assert_equal([
|
||||
\ ' 1: 4 #define FOO 4',
|
||||
\ ' 2: 5 #define FOO 5'], split(execute('+1,$dlist /FOO/'), "\n"))
|
||||
call assert_fails('dlist BAR', 'E388:')
|
||||
|
||||
" Test for [ CTRL-D and ] CTRL-D
|
||||
exe "normal [\<C-D>"
|
||||
call assert_equal([1, 9], [line('.'), col('.')])
|
||||
exe "normal 2j4[\<C-D>"
|
||||
call assert_equal([4, 9], [line('.'), col('.')])
|
||||
call assert_fails("normal k3[\<C-D>", 'E387:')
|
||||
call assert_fails("normal 6[\<C-D>", 'E388:')
|
||||
exe "normal ]\<C-D>"
|
||||
call assert_equal([4, 9], [line('.'), col('.')])
|
||||
exe "normal k2]\<C-D>"
|
||||
call assert_equal([5, 9], [line('.'), col('.')])
|
||||
call assert_fails("normal 2k3]\<C-D>", 'E388:')
|
||||
|
||||
" Test for :djump
|
||||
call cursor(3, 9)
|
||||
djump FOO
|
||||
call assert_equal([1, 9], [line('.'), col('.')])
|
||||
call cursor(3, 9)
|
||||
djump 4 /FOO/
|
||||
call assert_equal([4, 9], [line('.'), col('.')])
|
||||
call cursor(3, 9)
|
||||
call assert_fails('djump 3 FOO', 'E387:')
|
||||
+,$djump 2 FOO
|
||||
call assert_equal([5, 9], [line('.'), col('.')])
|
||||
call assert_fails('djump BAR', 'E388:')
|
||||
|
||||
" Test for CTRL-W d
|
||||
call cursor(3, 9)
|
||||
wincmd d
|
||||
call assert_equal([1, 9, 3], [line('.'), col('.'), winnr('$')])
|
||||
close
|
||||
5wincmd d
|
||||
call assert_equal([5, 9, 3], [line('.'), col('.'), winnr('$')])
|
||||
close
|
||||
call assert_fails('3wincmd d', 'E387:')
|
||||
call assert_fails('6wincmd d', 'E388:')
|
||||
|
||||
" Test for :dsplit
|
||||
dsplit FOO
|
||||
call assert_equal([1, 9, 3], [line('.'), col('.'), winnr('$')])
|
||||
close
|
||||
dsplit 5 /FOO/
|
||||
call assert_equal([5, 9, 3], [line('.'), col('.'), winnr('$')])
|
||||
close
|
||||
call assert_fails('dsplit 3 FOO', 'E387:')
|
||||
call assert_fails('dsplit 6 FOO', 'E388:')
|
||||
call assert_fails('dsplit BAR', 'E388:')
|
||||
|
||||
close!
|
||||
endfunc
|
||||
|
||||
func Test_define_search()
|
||||
" this was accessing freed memory
|
||||
new
|
||||
|
@ -1857,6 +1857,16 @@ func Test_deep_nest()
|
||||
call delete('Xscript')
|
||||
endfunc
|
||||
|
||||
" Test for <sfile>, <slnum> in a function {{{1
|
||||
func Test_sfile_in_function()
|
||||
func Xfunc()
|
||||
call assert_match('..Test_sfile_in_function\[5]..Xfunc', expand('<sfile>'))
|
||||
call assert_equal('2', expand('<slnum>'))
|
||||
endfunc
|
||||
call Xfunc()
|
||||
delfunc Xfunc
|
||||
endfunc
|
||||
|
||||
func Test_for_over_string()
|
||||
let res = ''
|
||||
for c in 'aéc̀d'
|
||||
|
@ -893,6 +893,15 @@ func Test_window_only()
|
||||
new
|
||||
call assert_fails('only', 'E445:')
|
||||
only!
|
||||
" Test for :only with a count
|
||||
let wid = win_getid()
|
||||
new
|
||||
new
|
||||
3only
|
||||
call assert_equal(1, winnr('$'))
|
||||
call assert_equal(wid, win_getid())
|
||||
call assert_fails('close', 'E444:')
|
||||
call assert_fails('%close', 'E16:')
|
||||
endfunc
|
||||
|
||||
" Test for errors with :wincmd
|
||||
|
@ -207,9 +207,7 @@ func Test_write_errors()
|
||||
close!
|
||||
|
||||
call assert_fails('w > Xtest', 'E494:')
|
||||
|
||||
call assert_fails('w > Xtest', 'E494:')
|
||||
|
||||
|
||||
" Try to overwrite a directory
|
||||
if has('unix')
|
||||
call mkdir('Xdir1')
|
||||
|
@ -87,11 +87,22 @@ describe('Ex mode', function()
|
||||
:^ |
|
||||
]])
|
||||
|
||||
-- Pressing enter in ex mode should print the current line
|
||||
feed('<CR>')
|
||||
screen:expect([[
|
||||
1 foo foo |
|
||||
^^^y |
|
||||
2 foo foo |
|
||||
^^^q |
|
||||
3 foo foo |
|
||||
:^ |
|
||||
]])
|
||||
|
||||
feed(':vi<CR>')
|
||||
screen:expect([[
|
||||
1 foo bar |
|
||||
2 fo^o foo |
|
||||
3 foo foo |
|
||||
2 foo foo |
|
||||
3 ^foo foo |
|
||||
~ |
|
||||
~ |
|
||||
|
|
||||
|
Loading…
Reference in New Issue
Block a user