Mercurial > vim
diff src/testdir/test_vim9_func.vim @ 22742:f7f2d73ff85e v8.2.1919
patch 8.2.1919: assert_fails() setting emsg_silent changes normal execution
Commit: https://github.com/vim/vim/commit/28ee892ac4197421b3317f195512ca64cc56a5b4
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Oct 28 20:20:00 2020 +0100
patch 8.2.1919: assert_fails() setting emsg_silent changes normal execution
Problem: Assert_fails() setting emsg_silent changes normal execution.
Solution: Use a separate flag in_assert_fails.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 28 Oct 2020 20:30:04 +0100 |
parents | 56907027dba7 |
children | d235c5fa0bbe |
line wrap: on
line diff
--- 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