Mercurial > vim
diff src/testdir/test_vim9_func.vim @ 23102:3239b0f3c592 v8.2.2097
patch 8.2.2097: Vim9: using :silent! when calling a function prevents abort
Commit: https://github.com/vim/vim/commit/56602ba153af7130b76daf83933922aaea3e2646
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Dec 5 21:22:08 2020 +0100
patch 8.2.2097: Vim9: using :silent! when calling a function prevents abort
Problem: Vim9: using :silent! when calling a function prevents abortng that
function.
Solution: Add emsg_silent_def and did_emsg_def.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 05 Dec 2020 21:30:03 +0100 |
parents | 9c3a6c33c0e5 |
children | 892303d45d2a |
line wrap: on
line diff
--- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -1784,6 +1784,22 @@ def Test_reset_did_emsg() delfunc! g:Func enddef +def Test_abort_with_silent_call() + var lines =<< trim END + vim9script + g:result = 'none' + def Func() + g:result += 3 + g:result = 'yes' + enddef + # error is silenced, but function aborts on error + silent! Func() + assert_equal('none', g:result) + unlet g:result + END + CheckScriptSuccess(lines) +enddef + def Test_continues_with_silent_error() var lines =<< trim END vim9script