Mercurial > vim
comparison src/testdir/test_vim9_func.vim @ 22736:56907027dba7 v8.2.1916
patch 8.2.1916: Vim9: function call is aborted even when "silent!" is used
Commit: https://github.com/vim/vim/commit/171fb923b8f8da9fb0db1c8c86e35cf4e1339000
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Oct 28 16:54:47 2020 +0100
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 https://github.com/vim/vim/issues/7213)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 28 Oct 2020 17:00:03 +0100 |
parents | 02b782e80ee4 |
children | f7f2d73ff85e |
comparison
equal
deleted
inserted
replaced
22735:6a0c4559c941 | 22736:56907027dba7 |
---|---|
1460 " clean up | 1460 " clean up |
1461 call StopVimInTerminal(buf) | 1461 call StopVimInTerminal(buf) |
1462 call delete('XTest_silent_echo') | 1462 call delete('XTest_silent_echo') |
1463 endfunc | 1463 endfunc |
1464 | 1464 |
1465 def SilentlyError() | |
1466 execute('silent! invalid') | |
1467 g:did_it = 'yes' | |
1468 enddef | |
1469 | |
1470 "func UserError() | |
1471 " silent! invalid | |
1472 "endfunc | |
1473 " | |
1474 "def SilentlyUserError() | |
1475 " UserError() | |
1476 " g:did_it = 'yes' | |
1477 "enddef | |
1478 | |
1479 " This can't be a :def function, because the assert would not be reached. | |
1480 " And this must not be inside a try/endtry. | |
1481 func Test_ignore_silent_error() | |
1482 let g:did_it = 'no' | |
1483 call SilentlyError() | |
1484 call assert_equal('yes', g:did_it) | |
1485 | |
1486 " this doesn't work yet | |
1487 " let g:did_it = 'no' | |
1488 " call SilentlyUserError() | |
1489 " call assert_equal('yes', g:did_it) | |
1490 | |
1491 unlet g:did_it | |
1492 endfunc | |
1493 | |
1465 def Fibonacci(n: number): number | 1494 def Fibonacci(n: number): number |
1466 if n < 2 | 1495 if n < 2 |
1467 return n | 1496 return n |
1468 else | 1497 else |
1469 return Fibonacci(n - 1) + Fibonacci(n - 2) | 1498 return Fibonacci(n - 1) + Fibonacci(n - 2) |