forked from aniani/vim
patch 8.2.1916: Vim9: function call is aborted even when "silent!" is used
Problem: Vim9: function call is aborted even when "silent!" is used. Solution: Use did_emsg instead of called_emsg. (closes #7213)
This commit is contained in:
@@ -1462,6 +1462,35 @@ func Test_silent_echo()
|
||||
call delete('XTest_silent_echo')
|
||||
endfunc
|
||||
|
||||
def SilentlyError()
|
||||
execute('silent! invalid')
|
||||
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.
|
||||
func Test_ignore_silent_error()
|
||||
let g:did_it = 'no'
|
||||
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)
|
||||
|
||||
unlet g:did_it
|
||||
endfunc
|
||||
|
||||
def Fibonacci(n: number): number
|
||||
if n < 2
|
||||
return n
|
||||
|
||||
Reference in New Issue
Block a user