0
0
mirror of https://github.com/vim/vim.git synced 2025-10-01 04:54:07 -04:00

patch 8.2.2817: Vim9: script sourcing continues after an error

Problem:    Vim9: script sourcing continues after an error.
Solution:   Make an error in any command in "vim9script" abort sourcing.
This commit is contained in:
Bram Moolenaar
2021-04-28 20:40:44 +02:00
parent 03717bf6a2
commit 227c58a486
5 changed files with 28 additions and 7 deletions

View File

@@ -854,6 +854,20 @@ def Test_error_in_nested_function()
assert_equal(0, g:test_var)
enddef
def Test_abort_after_error()
var lines =<< trim END
vim9script
while true
echo notfound
endwhile
g:gotthere = true
END
g:gotthere = false
CheckScriptFailure(lines, 'E121:')
assert_false(g:gotthere)
unlet g:gotthere
enddef
def Test_cexpr_vimscript()
# only checks line continuation
set errorformat=File\ %f\ line\ %l
@@ -3361,6 +3375,7 @@ def Test_vim9_autoload()
return 'test'
enddef
g:some#name = 'name'
g:some#dict = {key: 'value'}
def some#varargs(a1: string, ...l: list<string>): string
return a1 .. l[0] .. l[1]
@@ -3374,6 +3389,7 @@ def Test_vim9_autoload()
assert_equal('test', g:some#gettest())
assert_equal('name', g:some#name)
assert_equal('value', g:some#dict.key)
g:some#other = 'other'
assert_equal('other', g:some#other)