patch 8.2.3417: Vim9: a failing debug expression aborts script sourcing
Problem: Vim9: a failing debug expression aborts script sourcing.
Solution: Do not let expression failure abort script sourcing. (closes #8848)
diff --git a/src/testdir/test_debugger.vim b/src/testdir/test_debugger.vim
index 85ab6ea..71fdedc 100644
--- a/src/testdir/test_debugger.vim
+++ b/src/testdir/test_debugger.vim
@@ -318,7 +318,9 @@
call RunDbgCmd(buf, 'enew! | only!')
call StopVimInTerminal(buf)
+endfunc
+func Test_Debugger_breakadd()
" Tests for :breakadd file and :breakadd here
" Breakpoints should be set before sourcing the file
@@ -342,10 +344,37 @@
call delete('Xtest.vim')
%bw!
+
call assert_fails('breakadd here', 'E32:')
call assert_fails('breakadd file Xtest.vim /\)/', 'E55:')
endfunc
+def Test_Debugger_breakadd_expr()
+ var lines =<< trim END
+ vim9script
+ func g:EarlyFunc()
+ endfunc
+ breakadd expr DoesNotExist()
+ func g:LaterFunc()
+ endfunc
+ breakdel *
+ END
+ writefile(lines, 'Xtest.vim')
+
+ # Start Vim in a terminal
+ var buf = RunVimInTerminal('-S Xtest.vim', {wait_for_ruler: 0})
+ call TermWait(buf)
+
+ # Despite the failure the functions are defined
+ RunDbgCmd(buf, ':function g:EarlyFunc',
+ ['function EarlyFunc()', 'endfunction'], {match: 'pattern'})
+ RunDbgCmd(buf, ':function g:LaterFunc',
+ ['function LaterFunc()', 'endfunction'], {match: 'pattern'})
+
+ call StopVimInTerminal(buf)
+ call delete('Xtest.vim')
+enddef
+
func Test_Backtrace_Through_Source()
CheckCWD
let file1 =<< trim END