call test_override('char_avail', 1)
eval 1->test_override('redraw')
call test_override('ALL', 0)
- call assert_fails("call test_override('xxx', 1)", 'E475')
- call assert_fails("call test_override('redraw', 'yes')", 'E474')
+ call assert_fails("call test_override('xxx', 1)", 'E475:')
+ call assert_fails("call test_override('redraw', 'yes')", 'E474:')
endfunc
func Test_mouse_position()
call writefile(content, 'Xvimrc')
call system(GetVimCommand('Xvimrc') .. ' --not-a-term --noplugins -S Session.vim -c cq')
let errors = join(readfile('Xerrors'))
- call assert_match('E814', errors)
+ call assert_match('E814:', errors)
set swapfile
for file in ['Session.vim', 'Xvimrc', 'Xerrors']
" try twice, first time, shouldn't trigger because option name is invalid,
" second time, it should trigger
let bnum = bufnr('%')
- call assert_fails("call setbufvar(bnum, '&l:bk', 1)", "E355")
+ call assert_fails("call setbufvar(bnum, '&l:bk', 1)", 'E355:')
" should trigger, use correct option name
call setbufvar(bnum, '&backup', 1)
call assert_equal([], g:options)
au OptionSet diff close
call setline(1, ['buffer 1', 'line2', 'line3', 'line4'])
- call assert_fails(':diffthis', 'E788')
+ call assert_fails(':diffthis', 'E788:')
call assert_equal(1, &diff)
vnew
call setline(1, ['buffer 2', 'line 2', 'line 3', 'line4'])
- call assert_fails(':diffthis', 'E788')
+ call assert_fails(':diffthis', 'E788:')
call assert_equal(1, &diff)
set diffopt-=closeoff
bw!
- call assert_fails(':diffoff!', 'E788')
+ call assert_fails(':diffoff!', 'E788:')
bw!
" Cleanup
bdel Xtest
e Xxx1
" write it, will unload it and give an error msg
- call assert_fails('w', 'E203')
+ call assert_fails('w', 'E203:')
call assert_equal('Xxx2', bufname('%'))
edit Xtest
e! Xxx2
bwipe Xtest
" write it, will delete the buffer and give an error msg
- call assert_fails('w', 'E203')
+ call assert_fails('w', 'E203:')
call assert_equal('Xxx1', bufname('%'))
au! BufWritePre
call delete('Xxx1')
au BufWriteCmd XtestA call append(line("$"), "write")
write " will append a line to the file
call assert_equal('write', getline('$'))
- call assert_fails('read XtestA', 'E484') " should not read anything
+ call assert_fails('read XtestA', 'E484:') " should not read anything
call assert_equal('write', getline(4))
" now we have:
normal 4GA1
4,5w XtestC " will copy lines 4 and 5 to the end
call assert_equal("\tabc21", getline(8))
- call assert_fails('r XtestC', 'E484') " should not read anything
+ call assert_fails('r XtestC', 'E484:') " should not read anything
call assert_equal("end of Xxx", getline(9))
" now we have:
au FileAppendCmd XtestD call extend(g:lines, getline(line("'["), line("']")))
w >>XtestD " will add lines to 'lines'
call assert_equal(9, len(g:lines))
- call assert_fails('$r XtestD', 'E484') " should not read anything
+ call assert_fails('$r XtestD', 'E484:') " should not read anything
call assert_equal(9, line('$'))
call assert_equal('end of Xxx', getline('$'))
CheckFeature quickfix
" Nasty autocommand: wipe buffer on any event.
au * x bwipe
- call assert_fails('lv½ /x', 'E937')
+ call assert_fails('lv½ /x', 'E937:')
au!
endfunc
set backspace-=eol
call assert_equal('', &backspace)
" Check the error
- call assert_equal(0, match(Exec('set backspace=ABC'), '.*E474'))
- call assert_equal(0, match(Exec('set backspace+=def'), '.*E474'))
+ call assert_equal(0, match(Exec('set backspace=ABC'), '.*E474:'))
+ call assert_equal(0, match(Exec('set backspace+=def'), '.*E474:'))
" NOTE: Vim doesn't check following error...
- "call assert_equal(0, match(Exec('set backspace-=ghi'), '.*E474'))
+ "call assert_equal(0, match(Exec('set backspace-=ghi'), '.*E474:'))
" Check backwards compatibility with version 5.4 and earlier
set backspace=0
call assert_equal('2', &backspace)
set backspace=3
call assert_equal('3', &backspace)
- call assert_false(match(Exec('set backspace=4'), '.*E474'))
- call assert_false(match(Exec('set backspace=10'), '.*E474'))
+ call assert_false(match(Exec('set backspace=4'), '.*E474:'))
+ call assert_false(match(Exec('set backspace=10'), '.*E474:'))
" Cleared when 'compatible' is set
set compatible
eval handle->ch_setoptions({'callback': 's:NotUsed'})
call ch_setoptions(handle, {'timeout': 1111})
call ch_setoptions(handle, {'mode': 'json'})
- call assert_fails("call ch_setoptions(handle, {'waittime': 111})", "E475")
+ call assert_fails("call ch_setoptions(handle, {'waittime': 111})", 'E475:')
call ch_setoptions(handle, {'callback': ''})
call ch_setoptions(handle, {'drop': 'never'})
call ch_setoptions(handle, {'drop': 'auto'})
- call assert_fails("call ch_setoptions(handle, {'drop': 'bad'})", "E475")
+ call assert_fails("call ch_setoptions(handle, {'drop': 'bad'})", 'E475:')
call assert_equal(0, ch_setoptions(handle, test_null_dict()))
call assert_equal(0, ch_setoptions(test_null_channel(), {'drop' : 'never'}))
call WaitForAssert({-> assert_equal('maybe', remote_expr(name, "testvar", "", 2))})
endif
- call assert_fails('call remote_send("XXX", ":let testvar = ''yes''\<CR>")', 'E241')
+ call assert_fails('call remote_send("XXX", ":let testvar = ''yes''\<CR>")', 'E241:')
" Expression evaluated locally.
if v:servername == ''
f %<
call assert_equal('foo-B', expand('%'))
new
- call assert_fails('f #<', 'E95')
+ call assert_fails('f #<', 'E95:')
bw!
f foo-B.txt
f %<-A
func Test_lockvar()
let x = 'hello'
lockvar x
- call assert_fails('let x = "there"', 'E741')
+ call assert_fails('let x = "there"', 'E741:')
if 0 | unlockvar x | endif
- call assert_fails('let x = "there"', 'E741')
+ call assert_fails('let x = "there"', 'E741:')
unlockvar x
let x = 'there'
catch
call assert_report('exception thrown')
endtry
- call assert_fails('cscope add', 'E560')
- call assert_fails('cscope add Xcscope.out', 'E568')
- call assert_fails('cscope add doesnotexist.out', 'E563')
+ call assert_fails('cscope add', 'E560:')
+ call assert_fails('cscope add Xcscope.out', 'E568:')
+ call assert_fails('cscope add doesnotexist.out', 'E563:')
if has('unix')
call assert_fails('cscope add /dev/null', 'E564:')
endif
endtry
" 'p' doesn't suppress real errors
call writefile([], 'Xfile')
- call assert_fails('call mkdir("Xfile", "p")', 'E739')
+ call assert_fails('call mkdir("Xfile", "p")', 'E739:')
call delete('Xfile')
call delete('Xmkdir', 'rf')
call assert_equal(0, mkdir(test_null_string()))
- call assert_fails('call mkdir([])', 'E730')
- call assert_fails('call mkdir("abc", [], [])', 'E745')
+ call assert_fails('call mkdir([])', 'E730:')
+ call assert_fails('call mkdir("abc", [], [])', 'E745:')
endfunc
func Test_line_continuation()
exe "lang collate" collate
" 5) Errors
- call assert_fails('call readdir(dir, 1, 1)', 'E715')
+ call assert_fails('call readdir(dir, 1, 1)', 'E715:')
call assert_fails('call readdir(dir, 1, #{sorta: 1})')
call assert_fails('call readdirex(dir, 1, #{sorta: 1})')
func Test_nested_global()
new
call setline(1, ['nothing', 'found', 'found bad', 'bad'])
- call assert_fails('g/found/3v/bad/s/^/++/', 'E147')
+ call assert_fails('g/found/3v/bad/s/^/++/', 'E147:')
g/found/v/bad/s/^/++/
call assert_equal(['nothing', '++found', 'found bad', 'bad'], getline(1, 4))
bwipe!
set guifontset=-*-notexist-*
call assert_report("'set guifontset=-*-notexist-*' should have failed")
catch
- call assert_exception('E598')
+ call assert_exception('E598:')
endtry
" Set it to an invalid value brutally for preparation.
let &guifontset = '-*-notexist-*'
set nohls
exe "normal! /\<CR>" | redraw
call assert_notequal(r1, screenattr(1,1))
- call assert_fails('let v:hlsearch=[]', 'E745')
+ call assert_fails('let v:hlsearch=[]', 'E745:')
call garbagecollect(1)
call getchar(1)
enew!
func Test_lambda_error()
" This was causing a crash
- call assert_fails('ec{@{->{d->()()', 'E15')
+ call assert_fails('ec{@{->{d->()()', 'E15:')
endfunc
func Test_closure_error()
let &t_k1 = old_t_k1
endif
- call assert_fails('let x = &t_xx', 'E113')
+ call assert_fails('let x = &t_xx', 'E113:')
let &t_xx = "yes"
call assert_equal("yes", &t_xx)
let &t_xx = ""
- call assert_fails('let x = &t_xx', 'E113')
+ call assert_fails('let x = &t_xx', 'E113:')
endfunc
func Test_let_option_error()
let _w = &tw
let &tw = 80
- call assert_fails('let &tw .= 1', 'E734')
+ call assert_fails('let &tw .= 1', 'E734:')
call assert_equal(80, &tw)
let &tw = _w
let _w = &fillchars
let &fillchars = "vert:|"
- call assert_fails('let &fillchars += "diff:-"', 'E734')
+ call assert_fails('let &fillchars += "diff:-"', 'E734:')
call assert_equal("vert:|", &fillchars)
let &fillchars = _w
endfunc
" removing items out of range: silently skip items that don't exist
let l = [0, 1, 2, 3]
- call assert_fails('unlet l[2:1]', 'E684')
+ call assert_fails('unlet l[2:1]', 'E684:')
let l = [0, 1, 2, 3]
unlet l[2:2]
call assert_equal([0, 1, 3], l)
unlet l[2:5]
call assert_equal([0, 1], l)
let l = [0, 1, 2, 3]
- call assert_fails('unlet l[-1:2]', 'E684')
+ call assert_fails('unlet l[-1:2]', 'E684:')
let l = [0, 1, 2, 3]
unlet l[-2:2]
call assert_equal([0, 1, 3], l)
let l = [0, 1, 2, 3]
let [va, vb] = l[2:3]
call assert_equal([2, 3], [va, vb])
- call assert_fails('let [va, vb] = l', 'E687')
- call assert_fails('let [va, vb] = l[1:1]', 'E688')
+ call assert_fails('let [va, vb] = l', 'E687:')
+ call assert_fails('let [va, vb] = l[1:1]', 'E688:')
endfunc
" test for range assign
call extend(d, {3:33, 1:99})
call extend(d, {'b':'bbb', 'c':'ccc'}, "keep")
- call assert_fails("call extend(d, {3:333,4:444}, 'error')", 'E737')
+ call assert_fails("call extend(d, {3:333,4:444}, 'error')", 'E737:')
call assert_equal({'c': 'ccc', '1': 99, 'b': [1, 2, function('strlen')], '3': 33, '-1': {'a': 1}}, d)
call filter(d, 'v:key =~ ''[ac391]''')
call assert_equal({'c': 'ccc', '1': 99, '3': 33, '-1': {'a': 1}}, d)
let l = [4, d, 6]
let d[3] = l
let dc = deepcopy(d)
- call assert_fails('call deepcopy(d, 1)', 'E698')
+ call assert_fails('call deepcopy(d, 1)', 'E698:')
let l2 = [0, l, l, 3]
let l[1] = l2
let l3 = deepcopy(l2)
unlet! d
let d = {'a': 99, 'b': 100}
lockvar 1 d
- call assert_fails('unlet d.a', 'E741')
+ call assert_fails('unlet d.a', 'E741:')
endfunc
" unlet after lock on dict item
unlet! d
let d = {'a': 99, 'b': 100}
lockvar d.a
- call assert_fails("call extend(d, {'a' : 123})", 'E741')
+ call assert_fails("call extend(d, {'a' : 123})", 'E741:')
call assert_equal({'a': 99, 'b': 100}, d)
endfunc
" No remove() of write-protected scope-level variable
func Tfunc1(this_is_a_long_parameter_name)
- call assert_fails("call remove(a:, 'this_is_a_long_parameter_name')", 'E742')
+ call assert_fails("call remove(a:, 'this_is_a_long_parameter_name')", 'E742:')
endfunc
func Test_dict_scope_var_remove()
call Tfunc1('testval')
" No extend() of write-protected scope-level variable
func Test_dict_scope_var_extend()
- call assert_fails("call extend(a:, {'this_is_a_long_parameter_name': 1234})", 'E742')
+ call assert_fails("call extend(a:, {'this_is_a_long_parameter_name': 1234})", 'E742:')
endfunc
func Tfunc2(this_is_a_long_parameter_name)
- call assert_fails("call extend(a:, {'this_is_a_long_parameter_name': 1234})", 'E742')
+ call assert_fails("call extend(a:, {'this_is_a_long_parameter_name': 1234})", 'E742:')
endfunc
func Test_dict_scope_var_extend_overwrite()
call Tfunc2('testval')
let cmd = s:gen_cmd('let x:foo = 1', a:x)
if a:fixed
- call assert_fails(cmd, 'E461')
+ call assert_fails(cmd, 'E461:')
else
exe cmd
exe s:gen_cmd('call assert_equal(1, x:foo)', a:x)
let cmd = s:gen_cmd('let x:["bar"] = 2', a:x)
if a:fixed
- call assert_fails(cmd, 'E461')
+ call assert_fails(cmd, 'E461:')
else
exe cmd
exe s:gen_cmd('call assert_equal(2, x:bar)', a:x)
let cmd = s:gen_cmd('call extend(x:, {"baz": 3})', a:x)
if a:fixed
- call assert_fails(cmd, 'E742')
+ call assert_fails(cmd, 'E742:')
else
exe cmd
exe s:gen_cmd('call assert_equal(3, x:baz)', a:x)
if a:fixed
if a:x ==# 'a'
- call assert_fails('unlet a:x', 'E795')
- call assert_fails('call remove(a:, "x")', 'E742')
+ call assert_fails('unlet a:x', 'E795:')
+ call assert_fails('call remove(a:, "x")', 'E742:')
elseif a:x ==# 'v'
- call assert_fails('unlet v:count', 'E795')
- call assert_fails('call remove(v:, "count")', 'E742')
+ call assert_fails('unlet v:count', 'E795:')
+ call assert_fails('call remove(v:, "count")', 'E742:')
endif
else
exe s:gen_cmd('unlet x:foo', a:x)
call assert_true(&modified)
set nomodified
- call assert_fails('1,2move 1', 'E134')
- call assert_fails('2,3move 2', 'E134')
+ call assert_fails('1,2move 1', 'E134:')
+ call assert_fails('2,3move 2', 'E134:')
call assert_fails("move -100", 'E16:')
call assert_fails("move +100", 'E16:')
call assert_fails('move', 'E16:')
" Edit a fresh file and wipe the buffer list so that there is no alternate
" file present. Next, check for the expected command failures.
edit Xfoo | %bw
- call assert_fails(':buffer #', 'E86')
- call assert_fails(':execute "normal! \<C-^>"', 'E23')
+ call assert_fails(':buffer #', 'E86:')
+ call assert_fails(':execute "normal! \<C-^>"', 'E23:')
call assert_fails("normal i\<C-R>#", 'E23:')
" Test for the expected behavior when switching between two named buffers.
" there is only one change in the changelist
" currently, when we setup the window
call assert_equal(2, line('.'))
- call assert_fails(':norm! g;', 'E662')
- call assert_fails(':norm! g,', 'E663')
+ call assert_fails(':norm! g;', 'E662:')
+ call assert_fails(':norm! g,', 'E663:')
let &ul=&ul
call append('$', ['a', 'b', 'c', 'd'])
let &ul=&ul
" unfortunately, without a gui, we can't really test much here,
" so simply test that ~p fails (which uses the drop register)
new
- call assert_fails(':norm! "~p', 'E353')
+ call assert_fails(':norm! "~p', 'E353:')
call assert_equal([], getreg('~', 1, 1))
" the ~ register is read only
- call assert_fails(':let @~="1"', 'E354')
+ call assert_fails(':let @~="1"', 'E354:')
bw!
endfunc
new
exe "norm! \<c-w>c"
call assert_equal(1, winnr('$'))
- call assert_fails(":norm! \<c-w>c", "E444")
+ call assert_fails(":norm! \<c-w>c", 'E444:')
endfunc
func Test_normal49_counts()
"call feedkeys("\<c-^>", 'tm')
" should also fail with E11
- call assert_fails(":wincmd p", 'E11')
+ call assert_fails(":wincmd p", 'E11:')
" return from commandline window
call feedkeys("\<cr>")
endfunc
new Xreadonly.log
setl ro
au FileChangedRO <buffer> :call feedkeys("\<c-^>", 'tix')
- call assert_fails(":norm! Af", 'E788')
+ call assert_fails(":norm! Af", 'E788:')
call assert_equal(['foo'], getline(1,'$'))
call assert_equal('Xreadonly.log', bufname(''))
func Test_nv_hat_count()
%bwipeout!
let l:nr = bufnr('%') + 1
- call assert_fails(':execute "normal! ' . l:nr . '\<C-^>"', 'E92')
+ call assert_fails(':execute "normal! ' . l:nr . '\<C-^>"', 'E92:')
edit Xfoo
let l:foo_nr = bufnr('Xfoo')
func Test_win_execute_closing_curwin()
split
let winid = popup_create('some text', {})
- call assert_fails('call win_execute(winid, winnr() .. "close")', 'E994')
+ call assert_fails('call win_execute(winid, winnr() .. "close")', 'E994:')
call popup_clear()
let winid = popup_create('some text', {})
- call assert_fails('call win_execute(winid, printf("normal! :\<C-u>call popup_close(%d)\<CR>", winid))', 'E994')
+ call assert_fails('call win_execute(winid, printf("normal! :\<C-u>call popup_close(%d)\<CR>", winid))', 'E994:')
call popup_clear()
endfunc
setlocal nomodifiable
normal! yy
- call assert_fails(':put', 'E21')
- call assert_fails(':put!', 'E21')
- call assert_fails(':normal! p', 'E21')
- call assert_fails(':normal! gp', 'E21')
- call assert_fails(':normal! P', 'E21')
- call assert_fails(':normal! gP', 'E21')
+ call assert_fails(':put', 'E21:')
+ call assert_fails(':put!', 'E21:')
+ call assert_fails(':normal! p', 'E21:')
+ call assert_fails(':normal! gp', 'E21:')
+ call assert_fails(':normal! P', 'E21:')
+ call assert_fails(':normal! gP', 'E21:')
if has('mouse')
set mouse=n
- call assert_fails('execute "normal! \<MiddleMouse>"', 'E21')
+ call assert_fails('execute "normal! \<MiddleMouse>"', 'E21:')
set mouse&
endif
\ l[1].lnum == 800 && l[1].col == 15 && l[1].text ==# 'Line 800')
" Test with a non existent file
- call assert_fails('Xfile non_existent_file', 'E40')
+ call assert_fails('Xfile non_existent_file', 'E40:')
" Run cfile/lfile from a modified buffer
enew!
Xfirst
call assert_fails('-5Xcc', 'E16:')
- call assert_fails('Xprev', 'E553')
- call assert_fails('Xpfile', 'E553')
+ call assert_fails('Xprev', 'E553:')
+ call assert_fails('Xpfile', 'E553:')
Xnfile
call assert_equal('Xqftestfile2', @%)
call assert_equal(10, line('.'))
Xprev
call assert_equal('Xqftestfile2', @%)
call assert_equal(11, line('.'))
- call assert_fails('Xnext', 'E553')
- call assert_fails('Xnfile', 'E553')
+ call assert_fails('Xnext', 'E553:')
+ call assert_fails('Xnfile', 'E553:')
" To process the range using quickfix list entries, directly use the
" quickfix commands (don't use the user defined commands)
if a:cchar == 'c'
endif
" Invalid arguments
- call assert_fails('call g:Xgetlist([])', 'E715')
- call assert_fails('call g:Xsetlist([], "a", [])', 'E715')
+ call assert_fails('call g:Xgetlist([])', 'E715:')
+ call assert_fails('call g:Xsetlist([], "a", [])', 'E715:')
let s = g:Xsetlist([], 'a', {'abc':1})
call assert_equal(-1, s)
func Test_cclose_from_copen()
augroup QF_Test
au!
- au FileType qf :call assert_fails(':cclose', 'E788')
+ au FileType qf :call assert_fails(':cclose', 'E788:')
augroup END
copen
augroup QF_Test
call test_override('starting', 1)
augroup QF_Test
au!
- au FileType qf :call assert_fails(':cclose', 'E788')
+ au FileType qf :call assert_fails(':cclose', 'E788:')
augroup END
copen
augroup QF_Test
" Fails with argument.
augroup QF_Test
au!
- au FileType qf call assert_fails(':file foo', 'E788')
+ au FileType qf call assert_fails(':file foo', 'E788:')
augroup END
copen
augroup QF_Test
func Test_lfile_crash()
sp Xtest
au QuickFixCmdPre * bw
- call assert_fails('lfile', 'E40')
+ call assert_fails('lfile', 'E40:')
au! QuickFixCmdPre
endfunc
call g:Xsetlist([])
Xopen
let l:win_count = winnr('$')
- call assert_fails('execute "normal! \<C-W>\<CR>"', 'E42')
+ call assert_fails('execute "normal! \<C-W>\<CR>"', 'E42:')
call assert_equal(l:win_count, winnr('$'))
Xclose
endfunc
" Can't rename to en empty file name.
call assert_notequal(0, rename('Xrenamefile', ''))
- call assert_fails('call rename("Xrenamefile", [])', 'E730')
- call assert_fails('call rename(0z, "Xrenamefile")', 'E976')
+ call assert_fails('call rename("Xrenamefile", [])', 'E730:')
+ call assert_fails('call rename(0z, "Xrenamefile")', 'E976:')
call delete('Xrenamefile')
endfunc
" In that case Vim should return "E35 no previous regular expression",
" but it looks like Vim still sees /foo and therefore the test fails.
" Therefore, disabling this test
- "call assert_fails(feedkeys("/foo\<c-w>\<cr>", 'tx'), 'E35')
+ "call assert_fails(feedkeys("/foo\<c-w>\<cr>", 'tx'), 'E35:')
"call assert_equal({'lnum': 1, 'leftcol': 0, 'col': 0, 'topfill': 0, 'topline': 1, 'coladd': 0, 'skipcol': 0, 'curswant': 0}, winsaveview())
" clean up
call feedkeys(":%smagic/the.e/xxx\<cr>", 'tx')
call assert_equal(' 2 xxx', getline('.'))
undo
- call assert_fails(":%snomagic/the.e/xxx\<cr>", 'E486')
+ call assert_fails(":%snomagic/the.e/xxx\<cr>", 'E486:')
"
call feedkeys(":%snomagic/the\\.e/xxx\<cr>", 'tx')
call assert_equal(' 2 xxx', getline('.'))
func Test_search_sentence()
new
" this used to cause a crash
- call assert_fails("/\\%')", 'E486')
- call assert_fails("/", 'E486')
+ call assert_fails("/\\%')", 'E486:')
+ call assert_fails("/", 'E486:')
/\%'(
/
endfunc
call assert_fails('call sign_unplacelist([[]])', "E715:")
call assert_fails('call sign_unplacelist(["abc"])', "E715:")
call assert_fails('call sign_unplacelist([100])', "E715:")
- call assert_fails("call sign_unplacelist([{'id' : -1}])", 'E474')
+ call assert_fails("call sign_unplacelist([{'id' : -1}])", 'E474:')
call assert_equal([0, 0, 0, 0],
\ sign_undefine(['sign1', 'sign2', 'sign3', 'sign4']))
" 20 arguments plus one is too many
let Replacer = function('SubReplacer20', repeat(['foo'], 20))
- call assert_fails("call substitute('123', '2', Replacer, 'g')", 'E118')
+ call assert_fails("call substitute('123', '2', Replacer, 'g')", 'E118:')
endfunc
" Tests for *sub-replace-special* and *sub-replace-expression* on :substitute.
call Run_SubCmd_Tests(tests)
exe "normal oQ\nQ\<Esc>k"
- call assert_fails('s/Q[^\n]Q/\=submatch(0)."foobar"/', 'E486')
+ call assert_fails('s/Q[^\n]Q/\=submatch(0)."foobar"/', 'E486:')
enew!
endfunc
call assert_notmatch('.* cppNumber*', a)
call assert_notmatch('[1-9]', a)
- call assert_fails('syntime abc', 'E475')
+ call assert_fails('syntime abc', 'E475:')
syntax clear
let a = execute('syntime report')
syntax on
set foldmethod=syntax
- call assert_fails('syn foldlevel start start', 'E390')
- call assert_fails('syn foldlevel not_an_option', 'E390')
+ call assert_fails('syn foldlevel start start', 'E390:')
+ call assert_fails('syn foldlevel not_an_option', 'E390:')
set foldlevel=1
return v:null
endfunc
set tags= tfu=NullTagFunc
- call assert_fails('tag nothing', 'E433')
+ call assert_fails('tag nothing', 'E433:')
delf NullTagFunc
bwipe!
CheckFeature quickfix
set notagstack
- call assert_fails('ptag does_not_exist_tag_name', 'E433')
+ call assert_fails('ptag does_not_exist_tag_name', 'E433:')
set tagstack&vim
endfunc
" Error cases
call assert_equal({}, gettagstack(100))
call assert_equal(-1, settagstack(100, {'items' : []}))
- call assert_fails('call settagstack(1, [1, 10])', 'E715')
- call assert_fails("call settagstack(1, {'items' : 10})", 'E714')
- call assert_fails("call settagstack(1, {'items' : []}, 10)", 'E928')
- call assert_fails("call settagstack(1, {'items' : []}, 'b')", 'E962')
+ call assert_fails('call settagstack(1, [1, 10])', 'E715:')
+ call assert_fails("call settagstack(1, {'items' : 10})", 'E714:')
+ call assert_fails("call settagstack(1, {'items' : []}, 10)", 'E928:')
+ call assert_fails("call settagstack(1, {'items' : []}, 'b')", 'E962:')
call assert_equal(-1, settagstack(0, test_null_dict()))
set tags=Xtags
let old_vbs = &verbose
set verbose=5
" ":tjump" should give "tag not found" not "Format error in tags file"
- call assert_fails('tj /foo', 'E426')
+ call assert_fails('tj /foo', 'E426:')
try
tj /foo
catch /^Vim\%((\a\+)\)\=:E431/
call writefile([
\ '123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567 django/contrib/admin/templates/admin/edit_inline/stacked.html 16;" j line:16 language:HTML'
\ ], 'Xtags')
- call assert_fails('tj /foo', 'E426')
+ call assert_fails('tj /foo', 'E426:')
try
tj /foo
catch /^Vim\%((\a\+)\)\=:E431/
endfunc
func Test_tags_too_long()
- call assert_fails('tag ' . repeat('x', 1020), ['E433', 'E426'])
+ call assert_fails('tag ' . repeat('x', 1020), ['E433:', 'E426:'])
tags
endfunc
setlocal modifiable
exe "normal Axxx\<Esc>"
- call assert_fails(buf . 'bwipe', ['E89:', 'E517'])
+ call assert_fails(buf . 'bwipe', ['E89:', 'E517:'])
undo
exe buf . 'bwipe'
func Test_terminal_wipe_buffer()
let buf = Run_shell_in_terminal({})
- call assert_fails(buf . 'bwipe', ['E89', 'E517'])
+ call assert_fails(buf . 'bwipe', ['E89:', 'E517:'])
exe buf . 'bwipe!'
call WaitForAssert({-> assert_equal('dead', job_status(g:job))})
call assert_equal("", bufname(buf))
func Test_terminal_list_args()
let buf = term_start([&shell, &shellcmdflag, 'echo "123"'])
- call assert_fails(buf . 'bwipe', ['E89', 'E517'])
+ call assert_fails(buf . 'bwipe', ['E89:', 'E517:'])
exe buf . 'bwipe!'
call assert_equal("", bufname(buf))
endfunction
func Test_terminal_wqall()
let buf = Run_shell_in_terminal({})
- call assert_fails('wqall', 'E948')
+ call assert_fails('wqall', 'E948:')
call StopShellInTerminal(buf)
call TermWait(buf)
exe buf . 'bwipe'
func Test_terminal_term_start_empty_command()
let cmd = "call term_start('', {'curwin' : 1, 'term_finish' : 'close'})"
- call assert_fails(cmd, 'E474')
+ call assert_fails(cmd, 'E474:')
let cmd = "call term_start('', {'curwin' : 1, 'term_finish' : 'close'})"
- call assert_fails(cmd, 'E474')
+ call assert_fails(cmd, 'E474:')
let cmd = "call term_start({}, {'curwin' : 1, 'term_finish' : 'close'})"
- call assert_fails(cmd, 'E474')
+ call assert_fails(cmd, 'E474:')
let cmd = "call term_start(0, {'curwin' : 1, 'term_finish' : 'close'})"
- call assert_fails(cmd, 'E474')
+ call assert_fails(cmd, 'E474:')
let cmd = "call term_start('', {'term_name' : []})"
- call assert_fails(cmd, 'E730')
+ call assert_fails(cmd, 'E730:')
let cmd = "call term_start('', {'term_finish' : 'axby'})"
- call assert_fails(cmd, 'E475')
+ call assert_fails(cmd, 'E475:')
let cmd = "call term_start('', {'eof_chars' : []})"
call assert_fails(cmd, 'E730:')
let cmd = "call term_start('', {'term_kill' : []})"
call StopVimInTerminal(buf)
call delete('Xwinsize')
- call assert_fails('set termwinsize=40', 'E474')
- call assert_fails('set termwinsize=10+40', 'E474')
- call assert_fails('set termwinsize=abc', 'E474')
+ call assert_fails('set termwinsize=40', 'E474:')
+ call assert_fails('set termwinsize=10+40', 'E474:')
+ call assert_fails('set termwinsize=abc', 'E474:')
set termwinsize=
endfunc
unlet props[3]
call assert_equal(props, prop_list(1))
- call assert_fails("call prop_remove({'id': 11, 'both': 1})", 'E860')
- call assert_fails("call prop_remove({'type': 'three', 'both': 1})", 'E860')
+ call assert_fails("call prop_remove({'id': 11, 'both': 1})", 'E860:')
+ call assert_fails("call prop_remove({'type': 'three', 'both': 1})", 'E860:')
call DeletePropTypes()
bwipe!
endfunc
func Test_timer_invalid_callback()
- call assert_fails('call timer_start(0, "0")', 'E921')
+ call assert_fails('call timer_start(0, "0")', 'E921:')
endfunc
func Test_timer_changing_function_list()
call term_sendkeys(buf, ":fu\<CR>")
call WaitForAssert({-> assert_match('-- More --', term_getline(buf, 10))})
call term_sendkeys(buf, "G")
- call WaitForAssert({-> assert_match('E454', term_getline(buf, 9))})
+ call WaitForAssert({-> assert_match('E454:', term_getline(buf, 9))})
call term_sendkeys(buf, "\<Esc>")
call StopVimInTerminal(buf)
call assert_true(false, 'one in string is true')
endif
- call assert_fails('if [1]', 'E745')
- call assert_fails('if {1: 1}', 'E728')
- call assert_fails('if function("string")', 'E703')
+ call assert_fails('if [1]', 'E745:')
+ call assert_fails('if {1: 1}', 'E728:')
+ call assert_fails('if function("string")', 'E703:')
if has('float')
- call assert_fails('if 1.3")', 'E805')
+ call assert_fails('if 1.3")', 'E805:')
endif
endfunc
" Try to overwrite a function in the global (g:) scope
call assert_equal(3, max([1, 2, 3]))
- call assert_fails("call extend(g:, {'max': function('min')})", 'E704')
+ call assert_fails("call extend(g:, {'max': function('min')})", 'E704:')
call assert_equal(3, max([1, 2, 3]))
" Try to overwrite an user defined function with a function reference
if has('float')
call assert_equal(1.0, Log(10))
call assert_equal(log(10), Log(10, exp(1)))
- call assert_fails("call Log(1,2,3)", 'E118')
+ call assert_fails("call Log(1,2,3)", 'E118:')
endif
let res = Args(1)
call assert_equal(res.optional, 2)
call assert_equal(res['0'], 1)
- call assert_fails("call MakeBadFunc()", 'E989')
- call assert_fails("fu F(a=1 ,) | endf", 'E475')
+ call assert_fails("call MakeBadFunc()", 'E989:')
+ call assert_fails("fu F(a=1 ,) | endf", 'E475:')
let d = Args2(7, v:none, 9)
call assert_equal([7, 2, 9], [d.a, d.b, d.c])
def Test_error_in_nested_function()
# Error in called function requires unwinding the call stack.
- assert_fails('call FuncWithForwardCall()', 'E1096')
+ assert_fails('call FuncWithForwardCall()', 'E1096:')
enddef
def Test_return_type_wrong()
CallGoneSoon()
END
writefile(lines, 'XToDelFunc')
- assert_fails('so XToDelFunc', 'E933')
- assert_fails('so XToDelFunc', 'E933')
+ assert_fails('so XToDelFunc', 'E933:')
+ assert_fails('so XToDelFunc', 'E933:')
delete('XToDelFunc')
enddef
CheckScriptFailure(['vim9script', 'let str: string', 'str = 1234'], 'E1012:')
CheckScriptFailure(['vim9script', 'const str = "asdf"', 'str = "xxx"'], 'E46:')
- assert_fails('vim9script', 'E1038')
- assert_fails('export something', 'E1043')
+ assert_fails('vim9script', 'E1038:')
+ assert_fails('export something', 'E1043:')
enddef
func Test_import_fails_without_script()
call T1_G()
catch
" Catch missing :endif
- call assert_true(v:exception =~ 'E171')
+ call assert_true(v:exception =~ 'E171:')
Xpath 'x'
endtry
Xpath 'G'
ExecAsScript T1_G
catch
" Catch missing :endif
- call assert_true(v:exception =~ 'E171')
+ call assert_true(v:exception =~ 'E171:')
Xpath 'x'
endtry
Xpath 'G'
call assert_equal(10.5, x)
let x /= 2.5
call assert_equal(4.2, x)
- call assert_fails('let x %= 0.5', 'E734')
- call assert_fails('let x .= "f"', 'E734')
+ call assert_fails('let x %= 0.5', 'E734:')
+ call assert_fails('let x .= "f"', 'E734:')
let x = !3.14
call assert_equal(0.0, x)
" Test for environment variable
let $FOO = 1
- call assert_fails('let $FOO += 1', 'E734')
- call assert_fails('let $FOO -= 1', 'E734')
- call assert_fails('let $FOO *= 1', 'E734')
- call assert_fails('let $FOO /= 1', 'E734')
- call assert_fails('let $FOO %= 1', 'E734')
+ call assert_fails('let $FOO += 1', 'E734:')
+ call assert_fails('let $FOO -= 1', 'E734:')
+ call assert_fails('let $FOO *= 1', 'E734:')
+ call assert_fails('let $FOO /= 1', 'E734:')
+ call assert_fails('let $FOO %= 1', 'E734:')
let $FOO .= 's'
call assert_equal('1s', $FOO)
unlet $FOO
call assert_equal(6, &scrolljump)
let &scrolljump %= 5
call assert_equal(1, &scrolljump)
- call assert_fails('let &scrolljump .= "j"', 'E734')
+ call assert_fails('let &scrolljump .= "j"', 'E734:')
set scrolljump&vim
" Test for register
let @/ = 1
- call assert_fails('let @/ += 1', 'E734')
- call assert_fails('let @/ -= 1', 'E734')
- call assert_fails('let @/ *= 1', 'E734')
- call assert_fails('let @/ /= 1', 'E734')
- call assert_fails('let @/ %= 1', 'E734')
+ call assert_fails('let @/ += 1', 'E734:')
+ call assert_fails('let @/ -= 1', 'E734:')
+ call assert_fails('let @/ *= 1', 'E734:')
+ call assert_fails('let @/ /= 1', 'E734:')
+ call assert_fails('let @/ %= 1', 'E734:')
let @/ .= 's'
call assert_equal('1s', @/)
let @/ = ''
func Test_unlet_env()
let $TESTVAR = 'yes'
call assert_equal('yes', $TESTVAR)
- call assert_fails('lockvar $TESTVAR', 'E940')
- call assert_fails('unlockvar $TESTVAR', 'E940')
+ call assert_fails('lockvar $TESTVAR', 'E940:')
+ call assert_fails('unlockvar $TESTVAR', 'E940:')
call assert_equal('yes', $TESTVAR)
if 0
unlet $TESTVAR
" Test for errors in converting to float from various types {{{1
func Test_float_conversion_errors()
if has('float')
- call assert_fails('let x = 4.0 % 2.0', 'E804')
- call assert_fails('echo 1.1[0]', 'E806')
+ call assert_fails('let x = 4.0 % 2.0', 'E804:')
+ call assert_fails('echo 1.1[0]', 'E806:')
call assert_fails('echo sort([function("min"), 1], "f")', 'E891:')
call assert_fails('echo 3.2 == "vim"', 'E892:')
call assert_fails('echo sort([[], 1], "f")', 'E893:')
call assert_equal(12, g:did_cont)
wincmd w
- call assert_fails('emenu WinBar.Next', 'E334')
+ call assert_fails('emenu WinBar.Next', 'E334:')
wincmd p
aunmenu WinBar.Next
" test for failing :rew when hidden not set
set nohidden
call setline(1, 'testtext 2 2')
- call assert_fails('rewind', 'E37')
+ call assert_fails('rewind', 'E37:')
call assert_equal('Xtest2', bufname('%'))
call assert_equal('testtext 2 2', getline(1))
" test ":edit" failing in modified buffer when 'hidden' not set
call setline(1, 'testtext 3 3')
- call assert_fails('edit Xtest1', 'E37')
+ call assert_fails('edit Xtest1', 'E37:')
call assert_equal('Xtest3', bufname('%'))
call assert_equal('testtext 3 3', getline(1))
split Xtest3
set nohidden
call setline(1, 'testtext 3 3 3')
- call assert_fails('close', 'E37')
+ call assert_fails('close', 'E37:')
call assert_equal('Xtest3', bufname('%'))
call assert_equal('testtext 3 3 3', getline(1))
call assert_equal('Xtest2', bufname('%'))
quit!
call assert_equal('Xtest3', bufname('%'))
- call assert_fails('silent! quit!', 'E37')
+ call assert_fails('silent! quit!', 'E37:')
call assert_equal('Xtest1', bufname('%'))
call delete('Xtest1')
" Test for failure when the alternate buffer/file no longer exists.
edit Xfoo | %bw
- call assert_fails(':wincmd ^', 'E23')
+ call assert_fails(':wincmd ^', 'E23:')
" Test for the expected behavior when we have two named buffers.
edit Xfoo | edit Xbar
%bwipeout
let l:nr = bufnr('%') + 1
- call assert_fails(':execute "normal! ' . l:nr . '\<C-W>\<C-^>"', 'E92')
- call assert_fails(':' . l:nr . 'wincmd ^', 'E16')
- call assert_fails(':0wincmd ^', 'E16')
+ call assert_fails(':execute "normal! ' . l:nr . '\<C-W>\<C-^>"', 'E92:')
+ call assert_fails(':' . l:nr . 'wincmd ^', 'E16:')
+ call assert_fails(':0wincmd ^', 'E16:')
edit Xfoo | edit Xbar | edit Xbaz
let l:foo_nr = bufnr('Xfoo')
autocmd BufWritePre Xfile enew | write
augroup END
e Xfile
- call assert_fails('lockmarks write', ['E32', 'E203:'])
+ call assert_fails('lockmarks write', ['E32:', 'E203:'])
augroup WriteTest
au!
augroup END
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1593,
/**/
1592,
/**/