diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-10-28 20:20:00 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-10-28 20:20:00 +0100 |
commit | 28ee892ac4197421b3317f195512ca64cc56a5b4 (patch) | |
tree | 0a9eb799ec0e55a32600cc604cea653d9b91f322 /src/testdir | |
parent | 3e2534ed1a6557445747e6c1439ad26ec8eabfc4 (diff) |
patch 8.2.1919: assert_fails() setting emsg_silent changes normal executionv8.2.1919
Problem: Assert_fails() setting emsg_silent changes normal execution.
Solution: Use a separate flag in_assert_fails.
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/gen_opt_test.vim | 4 | ||||
-rw-r--r-- | src/testdir/test_autocmd.vim | 4 | ||||
-rw-r--r-- | src/testdir/test_mapping.vim | 2 | ||||
-rw-r--r-- | src/testdir/test_popup.vim | 2 | ||||
-rw-r--r-- | src/testdir/test_terminal.vim | 6 | ||||
-rw-r--r-- | src/testdir/test_vim9_func.vim | 23 |
6 files changed, 20 insertions, 21 deletions
diff --git a/src/testdir/gen_opt_test.vim b/src/testdir/gen_opt_test.vim index 271abedce3..600a790806 100644 --- a/src/testdir/gen_opt_test.vim +++ b/src/testdir/gen_opt_test.vim @@ -200,8 +200,8 @@ while 1 " setting an option can only fail when it's implemented. call add(script, "if exists('+" . name . "')") for val in a[1] - call add(script, "call assert_fails('set " . name . "=" . val . "')") - call add(script, "call assert_fails('set " . shortname . "=" . val . "')") + call add(script, "silent! call assert_fails('set " . name . "=" . val . "')") + call add(script, "silent! call assert_fails('set " . shortname . "=" . val . "')") endfor call add(script, "endif") endif diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim index 639f9eb675..1e8711c6b1 100644 --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -194,7 +194,7 @@ func Test_autocmd_bufunload_avoiding_SEGV_01() exe 'autocmd BufUnload <buffer> ' . (lastbuf + 1) . 'bwipeout!' augroup END - call assert_fails('edit bb.txt', ['E937:', 'E517:']) + call assert_fails('edit bb.txt', 'E937:') autocmd! test_autocmd_bufunload augroup! test_autocmd_bufunload @@ -1768,7 +1768,7 @@ endfunc func Test_nocatch_wipe_all_buffers() " Real nasty autocommand: wipe all buffers on any event. au * * bwipe * - call assert_fails('next x', ['E94:', 'E517:']) + call assert_fails('next x', ['E94:', 'E937:']) bwipe au! endfunc diff --git a/src/testdir/test_mapping.vim b/src/testdir/test_mapping.vim index 67a908a5af..5bec95a11c 100644 --- a/src/testdir/test_mapping.vim +++ b/src/testdir/test_mapping.vim @@ -681,7 +681,7 @@ func Test_expr_abbr() " invalid <expr> abbreviation abbr <expr> hte GetAbbr() call assert_fails('normal ihte ', 'E117:') - call assert_equal(' ', getline(1)) + call assert_equal('', getline(1)) unabbr <expr> hte close! diff --git a/src/testdir/test_popup.vim b/src/testdir/test_popup.vim index 381a2c19b4..28481b3a28 100644 --- a/src/testdir/test_popup.vim +++ b/src/testdir/test_popup.vim @@ -344,7 +344,7 @@ func Test_completefunc_opens_new_window_one() /^one call assert_fails('call feedkeys("A\<C-X>\<C-U>\<C-N>\<Esc>", "x")', 'E578:') call assert_equal(winid, win_getid()) - call assert_equal('oneDEF', getline(1)) + call assert_equal('onedef', getline(1)) q! endfunc diff --git a/src/testdir/test_terminal.vim b/src/testdir/test_terminal.vim index 676d864c72..829706c93b 100644 --- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -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:') 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:') 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:') exe buf . 'bwipe!' call assert_equal("", bufname(buf)) endfunction diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim index 919af74111..4ec0f6fdbc 100644 --- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -1467,14 +1467,14 @@ def SilentlyError() g:did_it = 'yes' enddef -"func UserError() -" silent! invalid -"endfunc -" -"def SilentlyUserError() -" UserError() -" g:did_it = 'yes' -"enddef +func UserError() + silent! invalid +endfunc + +def SilentlyUserError() + UserError() + g:did_it = 'yes' +enddef " This can't be a :def function, because the assert would not be reached. " And this must not be inside a try/endtry. @@ -1483,10 +1483,9 @@ func Test_ignore_silent_error() call SilentlyError() call assert_equal('yes', g:did_it) -" this doesn't work yet -" let g:did_it = 'no' -" call SilentlyUserError() -" call assert_equal('yes', g:did_it) + let g:did_it = 'no' + call SilentlyUserError() + call assert_equal('yes', g:did_it) unlet g:did_it endfunc |