From da20804a6abb70fb1bfb6a946b3703f6090f1600 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Mon, 19 Jan 2026 10:32:55 +0800 Subject: [PATCH] vim-patch:9.1.1325: tests: not checking error numbers properly Problem: tests: not checking error numbers properly. Solution: Add a trailing comma to avoid matching a different error number with the same prefix (zeertzjq) closes: vim/vim#17159 https://github.com/vim/vim/commit/67fe77d2724ec2041baef73edf20e828b43adcd2 --- test/old/testdir/test_arglist.vim | 2 +- test/old/testdir/test_autocmd.vim | 26 +++++++++++++------------- test/old/testdir/test_blob.vim | 4 ++-- test/old/testdir/test_edit.vim | 2 +- test/old/testdir/test_expr.vim | 6 +++--- test/old/testdir/test_listdict.vim | 2 +- test/old/testdir/test_startup.vim | 4 ++-- test/old/testdir/test_trycatch.vim | 12 ++++++------ test/old/testdir/test_usercommands.vim | 4 ++-- 9 files changed, 31 insertions(+), 31 deletions(-) diff --git a/test/old/testdir/test_arglist.vim b/test/old/testdir/test_arglist.vim index bcf2b055ec..42ff949935 100644 --- a/test/old/testdir/test_arglist.vim +++ b/test/old/testdir/test_arglist.vim @@ -640,7 +640,7 @@ endfunc func Test_clear_arglist_in_all() n 0 00 000 0000 00000 000000 au WinNew 0 n 0 - call assert_fails("all", "E1156") + call assert_fails("all", "E1156:") au! * endfunc diff --git a/test/old/testdir/test_autocmd.vim b/test/old/testdir/test_autocmd.vim index db6a992bd5..f35d1f8fe9 100644 --- a/test/old/testdir/test_autocmd.vim +++ b/test/old/testdir/test_autocmd.vim @@ -3817,10 +3817,10 @@ func Test_autocmd_normal_mess() au BufLeave,BufWinLeave,BufHidden,BufUnload,BufDelete,BufWipeout * norm 7q/qc augroup END " Nvim has removed :open - " call assert_fails('o4', 'E1159') - call assert_fails('e4', 'E1159') + " call assert_fails('o4', 'E1159:') + call assert_fails('e4', 'E1159:') silent! H - call assert_fails('e xx', 'E1159') + call assert_fails('e xx', 'E1159:') normal G augroup aucmd_normal_test @@ -4729,32 +4729,32 @@ func Test_autocmd_tabclosedpre() " Close tab in TabClosedPre autocmd call ClearAutomcdAndCreateTabs() au TabClosedPre * tabclose - call assert_fails('tabclose', 'E1312') + call assert_fails('tabclose', 'E1312:') call ClearAutomcdAndCreateTabs() au TabClosedPre * tabclose - call assert_fails('tabclose 2', 'E1312') + call assert_fails('tabclose 2', 'E1312:') call ClearAutomcdAndCreateTabs() au TabClosedPre * tabclose 1 - call assert_fails('tabclose', 'E1312') + call assert_fails('tabclose', 'E1312:') " Close other (all) tabs in TabClosedPre autocmd call ClearAutomcdAndCreateTabs() au TabClosedPre * tabonly - call assert_fails('tabclose', 'E1312') + call assert_fails('tabclose', 'E1312:') call ClearAutomcdAndCreateTabs() au TabClosedPre * tabonly - call assert_fails('tabclose 2', 'E1312') + call assert_fails('tabclose 2', 'E1312:') call ClearAutomcdAndCreateTabs() au TabClosedPre * tabclose 4 - call assert_fails('tabclose 2', 'E1312') + call assert_fails('tabclose 2', 'E1312:') " Open new tabs in TabClosedPre autocmd call ClearAutomcdAndCreateTabs() au TabClosedPre * tabnew D - call assert_fails('tabclose', 'E1312') + call assert_fails('tabclose', 'E1312:') call ClearAutomcdAndCreateTabs() au TabClosedPre * tabnew D - call assert_fails('tabclose 1', 'E1312') + call assert_fails('tabclose 1', 'E1312:') " Moving the tab page in TabClosedPre autocmd call ClearAutomcdAndCreateTabs() @@ -4783,10 +4783,10 @@ func Test_autocmd_tabclosedpre() " Create new windows in TabClosedPre autocmd call ClearAutomcdAndCreateTabs() au TabClosedPre * split | e X| vsplit | e Y | split | e Z - call assert_fails('tabclose', 'E242') + call assert_fails('tabclose', 'E242:') call ClearAutomcdAndCreateTabs() au TabClosedPre * new X | new Y | new Z - call assert_fails('tabclose 1', 'E242') + call assert_fails('tabclose 1', 'E242:') " Test directly closing the tab page with ':tabclose' au! diff --git a/test/old/testdir/test_blob.vim b/test/old/testdir/test_blob.vim index fbc080059e..0bb018f107 100644 --- a/test/old/testdir/test_blob.vim +++ b/test/old/testdir/test_blob.vim @@ -229,13 +229,13 @@ func Test_blob_compare() VAR b1 = 0z0011 echo b1 == 9 END - call CheckLegacyAndVim9Failure(lines, ['E977:', 'E1072', 'E1072']) + call CheckLegacyAndVim9Failure(lines, ['E977:', 'E1072:', 'E1072:']) let lines =<< trim END VAR b1 = 0z0011 echo b1 != 9 END - call CheckLegacyAndVim9Failure(lines, ['E977:', 'E1072', 'E1072']) + call CheckLegacyAndVim9Failure(lines, ['E977:', 'E1072:', 'E1072:']) let lines =<< trim END VAR b1 = 0z0011 diff --git a/test/old/testdir/test_edit.vim b/test/old/testdir/test_edit.vim index 59517726f0..1fc5cb8741 100644 --- a/test/old/testdir/test_edit.vim +++ b/test/old/testdir/test_edit.vim @@ -2123,7 +2123,7 @@ endfunc func Test_read_invalid() " set encoding=latin1 " This was not properly checking for going past the end. - call assert_fails('r`=', 'E484') + call assert_fails('r`=', 'E484:') set encoding=utf-8 endfunc diff --git a/test/old/testdir/test_expr.vim b/test/old/testdir/test_expr.vim index c5d3acb9b5..0907c1be6f 100644 --- a/test/old/testdir/test_expr.vim +++ b/test/old/testdir/test_expr.vim @@ -213,10 +213,10 @@ func Test_method_with_prefix() call CheckLegacyAndVim9Success(lines) call assert_equal([0, 1, 2], --3->range()) - call CheckDefAndScriptFailure(['eval --3->range()'], 'E15') + call CheckDefAndScriptFailure(['eval --3->range()'], 'E15:') call assert_equal(1, !+-+0) - call CheckDefAndScriptFailure(['eval !+-+0'], 'E15') + call CheckDefAndScriptFailure(['eval !+-+0'], 'E15:') endfunc func Test_option_value() @@ -836,7 +836,7 @@ endfunc " Test for errors in expression evaluation func Test_expr_eval_error() call CheckLegacyAndVim9Failure(["VAR i = 'abc' .. []"], ['E730:', 'E1105:', 'E730:']) - call CheckLegacyAndVim9Failure(["VAR l = [] + 10"], ['E745:', 'E1051:', 'E745']) + call CheckLegacyAndVim9Failure(["VAR l = [] + 10"], ['E745:', 'E1051:', 'E745:']) call CheckLegacyAndVim9Failure(["VAR v = 10 + []"], ['E745:', 'E1051:', 'E745:']) call CheckLegacyAndVim9Failure(["VAR v = 10 / []"], ['E745:', 'E1036:', 'E745:']) call CheckLegacyAndVim9Failure(["VAR v = -{}"], ['E728:', 'E1012:', 'E728:']) diff --git a/test/old/testdir/test_listdict.vim b/test/old/testdir/test_listdict.vim index 58c8a1705c..ff20585949 100644 --- a/test/old/testdir/test_listdict.vim +++ b/test/old/testdir/test_listdict.vim @@ -1366,7 +1366,7 @@ func Test_listdict_index() call CheckLegacyAndVim9Failure(['VAR d = {"k": 10}', 'echo d[1 : 2]'], 'E719:') call assert_fails("let v = [4, 6][{-> 1}]", 'E729:') - call CheckDefAndScriptFailure(['var v = [4, 6][() => 1]'], ['E1012', 'E703:']) + call CheckDefAndScriptFailure(['var v = [4, 6][() => 1]'], ['E1012:', 'E703:']) call CheckLegacyAndVim9Failure(['VAR v = range(5)[2 : []]'], ['E730:', 'E1012:', 'E730:']) diff --git a/test/old/testdir/test_startup.vim b/test/old/testdir/test_startup.vim index 974f8ce942..5f25f5eba5 100644 --- a/test/old/testdir/test_startup.vim +++ b/test/old/testdir/test_startup.vim @@ -1356,7 +1356,7 @@ func Test_cq_zero_exmode() let logfile = 'Xcq_log.txt' let out = system(GetVimCommand() .. ' --clean --log ' .. logfile .. ' -es -X -c "argdelete foobar" -c"7cq"') call assert_equal(8, v:shell_error) - let log = filter(readfile(logfile), {idx, val -> val =~ "E480"}) + let log = filter(readfile(logfile), {idx, val -> val =~ "E480:"}) call assert_match('E480: No match: foobar', log[0]) call delete(logfile) @@ -1367,7 +1367,7 @@ func Test_cq_zero_exmode() else call assert_equal(256, v:shell_error) endif - let log = filter(readfile(logfile), {idx, val -> val =~ "E480"}) + let log = filter(readfile(logfile), {idx, val -> val =~ "E480:"}) call assert_match('E480: No match: foobar', log[0]) call delete('Xcq_log.txt') endfunc diff --git a/test/old/testdir/test_trycatch.vim b/test/old/testdir/test_trycatch.vim index f2142f4210..3599a3e194 100644 --- a/test/old/testdir/test_trycatch.vim +++ b/test/old/testdir/test_trycatch.vim @@ -1850,7 +1850,7 @@ func T75_R() Xpath 'f' finally Xpath 'g' - if caught || $VIMNOERRTHROW && v:errmsg =~ 'E21' + if caught || $VIMNOERRTHROW && v:errmsg =~ 'E21:' Xpath 'h' endif break " discard error for $VIMNOERRTHROW @@ -1877,7 +1877,7 @@ func Test_builtin_func_error() Xpath 'k' finally Xpath 'l' - if caught || $VIMNOERRTHROW && v:errmsg =~ 'E21' + if caught || $VIMNOERRTHROW && v:errmsg =~ 'E21:' Xpath 'm' endif break " discard error for $VIMNOERRTHROW @@ -1896,7 +1896,7 @@ func Test_builtin_func_error() Xpath 'o' finally Xpath 'p' - if caught || $VIMNOERRTHROW && v:errmsg =~ 'E21' + if caught || $VIMNOERRTHROW && v:errmsg =~ 'E21:' Xpath 'q' endif break " discard error for $VIMNOERRTHROW @@ -1915,7 +1915,7 @@ func Test_builtin_func_error() Xpath 's' finally Xpath 't' - if caught || $VIMNOERRTHROW && v:errmsg =~ 'E21' + if caught || $VIMNOERRTHROW && v:errmsg =~ 'E21:' Xpath 'u' endif break " discard error for $VIMNOERRTHROW @@ -1938,7 +1938,7 @@ func Test_builtin_func_error() Xpath 'x' finally Xpath 'y' - if caught || $VIMNOERRTHROW && v:errmsg =~ 'E21' + if caught || $VIMNOERRTHROW && v:errmsg =~ 'E21:' Xpath 'z' endif break " discard error for $VIMNOERRTHROW @@ -1958,7 +1958,7 @@ func Test_builtin_func_error() Xpath 'B' finally Xpath 'C' - if caught || $VIMNOERRTHROW && v:errmsg =~ 'E21' + if caught || $VIMNOERRTHROW && v:errmsg =~ 'E21:' Xpath 'D' endif call assert_equal('a', x) diff --git a/test/old/testdir/test_usercommands.vim b/test/old/testdir/test_usercommands.vim index 9370cd021c..9a77544995 100644 --- a/test/old/testdir/test_usercommands.vim +++ b/test/old/testdir/test_usercommands.vim @@ -320,13 +320,13 @@ func Test_CmdErrors() vim9script com! -complete=file DoCmd : END - call CheckScriptFailure(lines, 'E1208', 2) + call CheckScriptFailure(lines, 'E1208:', 2) let lines =<< trim END vim9script com! -nargs=0 -complete=file DoCmd : END - call CheckScriptFailure(lines, 'E1208', 2) + call CheckScriptFailure(lines, 'E1208:', 2) com! -nargs=0 DoCmd : call assert_fails('DoCmd x', 'E488:')