0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 8.2.1593: tests do not check the error number properly

Problem:    Tests do not check the error number properly.0
Solution:   Add a colon after the error number. (closes #6869)
This commit is contained in:
Bram Moolenaar 2020-09-04 21:18:46 +02:00
parent 24f7750ffa
commit e2e4075fad
43 changed files with 172 additions and 170 deletions

View File

@ -341,8 +341,8 @@ func Test_override()
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()

View File

@ -468,7 +468,7 @@ func Test_autocmd_bufwipe_in_SessLoadPost()
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']
@ -638,7 +638,7 @@ func Test_OptionSet()
" 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)
@ -1175,15 +1175,15 @@ func Test_OptionSet_diffmode_close()
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
@ -1410,13 +1410,13 @@ func Test_BufWritePre()
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')
@ -1491,7 +1491,7 @@ func Test_Cmd_Autocmds()
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:
@ -1517,7 +1517,7 @@ func Test_Cmd_Autocmds()
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:
@ -1535,7 +1535,7 @@ func Test_Cmd_Autocmds()
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('$'))
@ -1776,7 +1776,7 @@ func Test_nocatch_wipe_dummy_buffer()
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

View File

@ -41,10 +41,10 @@ func Test_backspace_option()
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
@ -55,8 +55,8 @@ func Test_backspace_option()
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

View File

@ -163,11 +163,11 @@ func Ch_communicate(port)
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'}))

View File

@ -70,7 +70,7 @@ func Test_client_server()
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 == ''

View File

@ -843,7 +843,7 @@ func Test_cmdline_write_alternatefile()
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

View File

@ -207,9 +207,9 @@ endfunc
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'

View File

@ -31,9 +31,9 @@ func Test_cscopeWithCscopeConnections()
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

View File

@ -35,12 +35,12 @@ func Test_mkdir_p()
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()

View File

@ -2025,7 +2025,7 @@ func Test_readdir_sort()
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})')

View File

@ -29,7 +29,7 @@ endfunc
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!

View File

@ -525,7 +525,7 @@ func Test_set_guifontwide()
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-*'

View File

@ -28,7 +28,7 @@ func Test_hlsearch()
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!

View File

@ -308,7 +308,7 @@ endfunc
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()

View File

@ -250,23 +250,23 @@ func Test_let_termcap()
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

View File

@ -67,7 +67,7 @@ func Test_list_unlet()
" 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)
@ -81,7 +81,7 @@ func Test_list_unlet()
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)
@ -104,8 +104,8 @@ func Test_list_assign()
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
@ -186,7 +186,7 @@ func Test_dict()
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)
@ -343,7 +343,7 @@ func Test_dict_deepcopy()
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)
@ -522,7 +522,7 @@ func Test_dict_lock_unlet()
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
@ -557,7 +557,7 @@ func Test_dict_lock_extend()
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
@ -572,7 +572,7 @@ 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')
@ -580,11 +580,11 @@ endfunc
" 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')
@ -862,7 +862,7 @@ func s:check_scope_dict(x, fixed)
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)
@ -870,7 +870,7 @@ func s:check_scope_dict(x, fixed)
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)
@ -878,7 +878,7 @@ func s:check_scope_dict(x, fixed)
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)
@ -886,11 +886,11 @@ func s:check_scope_dict(x, fixed)
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)

View File

@ -33,8 +33,8 @@ func Test_move()
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:')

View File

@ -1265,8 +1265,8 @@ func Test_normal21_nv_hat()
" 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.
@ -1942,8 +1942,8 @@ func Test_normal33_g_cmd2()
" 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
@ -2466,10 +2466,10 @@ func Test_normal45_drop()
" 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
@ -2510,7 +2510,7 @@ func Test_normal48_wincmd()
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()
@ -2531,7 +2531,7 @@ func Test_normal50_commandline()
"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
@ -2560,7 +2560,7 @@ func Test_normal51_FileChangedRO()
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(''))
@ -2701,7 +2701,7 @@ endfunc
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')

View File

@ -976,11 +976,11 @@ endfunc
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

View File

@ -60,16 +60,16 @@ func Test_put_fails_when_nomodifiable()
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

View File

@ -359,7 +359,7 @@ func XfileTests(cchar)
\ 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!
@ -502,8 +502,8 @@ func Xtest_browse(cchar)
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('.'))
@ -526,8 +526,8 @@ func Xtest_browse(cchar)
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'
@ -2174,8 +2174,8 @@ func Xproperty_tests(cchar)
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)
@ -2978,7 +2978,7 @@ endfunc
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
@ -2993,7 +2993,7 @@ func Test_cclose_in_autocmd()
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
@ -3021,7 +3021,7 @@ func Test_file_from_copen()
" 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
@ -3702,7 +3702,7 @@ endfunc
func Test_lfile_crash()
sp Xtest
au QuickFixCmdPre * bw
call assert_fails('lfile', 'E40')
call assert_fails('lfile', 'E40:')
au! QuickFixCmdPre
endfunc
@ -4235,7 +4235,7 @@ func Xview_result_split_tests(cchar)
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

View File

@ -113,8 +113,8 @@ func Test_rename_fails()
" 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

View File

@ -266,7 +266,7 @@ func Test_search_cmdline2()
" 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
@ -470,7 +470,7 @@ func Test_search_cmdline3s()
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('.'))
@ -1278,8 +1278,8 @@ endfunc
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

View File

@ -1994,7 +1994,7 @@ func Test_sign_funcs_multi()
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']))

View File

@ -449,7 +449,7 @@ func Test_substitute_partial()
" 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.
@ -632,7 +632,7 @@ func Test_sub_cmd_7()
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

View File

@ -107,7 +107,7 @@ func Test_syntime()
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')
@ -718,8 +718,8 @@ func Test_syntax_foldlevel()
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

View File

@ -73,7 +73,7 @@ func Test_tagfunc()
return v:null
endfunc
set tags= tfu=NullTagFunc
call assert_fails('tag nothing', 'E433')
call assert_fails('tag nothing', 'E433:')
delf NullTagFunc
bwipe!

View File

@ -8,7 +8,7 @@ func Test_ptag_with_notagstack()
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
@ -365,10 +365,10 @@ func Test_getsettagstack()
" 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
@ -565,7 +565,7 @@ func Test_tag_line_toolong()
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/
@ -577,7 +577,7 @@ func Test_tag_line_toolong()
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/

View File

@ -83,7 +83,7 @@ func Test_taglist_ctags_etags()
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

View File

@ -65,7 +65,7 @@ func Test_terminal_make_change()
setlocal modifiable
exe "normal Axxx\<Esc>"
call assert_fails(buf . 'bwipe', ['E89:', 'E517'])
call assert_fails(buf . 'bwipe', ['E89:', 'E517:'])
undo
exe buf . 'bwipe'
@ -89,7 +89,7 @@ endfunc
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))
@ -648,7 +648,7 @@ endfunc
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
@ -892,7 +892,7 @@ endfunc
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'
@ -993,17 +993,17 @@ endfunc
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' : []})"

View File

@ -36,9 +36,9 @@ func Test_terminal_termwinsize_option_fixed()
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

View File

@ -314,8 +314,8 @@ func Test_prop_remove()
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!

View File

@ -422,7 +422,7 @@ func Test_timer_garbage_collect()
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()
@ -442,7 +442,7 @@ 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)

View File

@ -40,11 +40,11 @@ func Test_if()
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

View File

@ -88,7 +88,7 @@ func Test_user_func()
" 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
@ -131,7 +131,7 @@ func Test_default_arg()
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)
@ -149,8 +149,8 @@ func Test_default_arg()
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])

View File

@ -523,7 +523,7 @@ enddef
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()
@ -735,8 +735,8 @@ def Test_delfunc()
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

View File

@ -1575,8 +1575,8 @@ def Test_vim9script_fails()
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()

View File

@ -95,7 +95,7 @@ func Test_endwhile_function()
call T1_G()
catch
" Catch missing :endif
call assert_true(v:exception =~ 'E171')
call assert_true(v:exception =~ 'E171:')
Xpath 'x'
endtry
Xpath 'G'
@ -125,7 +125,7 @@ func Test_endwhile_script()
ExecAsScript T1_G
catch
" Catch missing :endif
call assert_true(v:exception =~ 'E171')
call assert_true(v:exception =~ 'E171:')
Xpath 'x'
endtry
Xpath 'G'
@ -7022,8 +7022,8 @@ func Test_compound_assignment_operators()
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)
@ -7044,11 +7044,11 @@ func Test_compound_assignment_operators()
" 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
@ -7065,16 +7065,16 @@ func Test_compound_assignment_operators()
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 @/ = ''
@ -7083,8 +7083,8 @@ endfunc
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
@ -7339,8 +7339,8 @@ endfunc
" 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:')

View File

@ -18,7 +18,7 @@ func Test_add_remove_menu()
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

View File

@ -27,7 +27,7 @@ func Test_winbuf_close()
" 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))
@ -66,7 +66,7 @@ func Test_winbuf_close()
" 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))
@ -80,7 +80,7 @@ func Test_winbuf_close()
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))
@ -115,7 +115,7 @@ func Test_winbuf_close()
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')

View File

@ -121,7 +121,7 @@ func Test_window_split_edit_alternate()
" 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
@ -154,9 +154,9 @@ func Test_window_split_edit_bufnr()
%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')

View File

@ -310,7 +310,7 @@ func Test_write_autocmd_unloadbuf_lockmark()
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

View File

@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1593,
/**/
1592,
/**/