comparison src/testdir/test_vim9_script.vim @ 24555:83877a1b66fd v8.2.2817

patch 8.2.2817: Vim9: script sourcing continues after an error Commit: https://github.com/vim/vim/commit/227c58a486d2459e7bf6ed2c917ede7e324e3570 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Apr 28 20:40:44 2021 +0200 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.
author Bram Moolenaar <Bram@vim.org>
date Wed, 28 Apr 2021 20:45:03 +0200
parents baf75c8e1b7b
children 80422f66978a
comparison
equal deleted inserted replaced
24554:75f45e1281be 24555:83877a1b66fd
850 Func() 850 Func()
851 END 851 END
852 g:test_var = 0 852 g:test_var = 0
853 CheckScriptFailure(lines, 'E684:') 853 CheckScriptFailure(lines, 'E684:')
854 assert_equal(0, g:test_var) 854 assert_equal(0, g:test_var)
855 enddef
856
857 def Test_abort_after_error()
858 var lines =<< trim END
859 vim9script
860 while true
861 echo notfound
862 endwhile
863 g:gotthere = true
864 END
865 g:gotthere = false
866 CheckScriptFailure(lines, 'E121:')
867 assert_false(g:gotthere)
868 unlet g:gotthere
855 enddef 869 enddef
856 870
857 def Test_cexpr_vimscript() 871 def Test_cexpr_vimscript()
858 # only checks line continuation 872 # only checks line continuation
859 set errorformat=File\ %f\ line\ %l 873 set errorformat=File\ %f\ line\ %l
3359 vim9script 3373 vim9script
3360 def some#gettest(): string 3374 def some#gettest(): string
3361 return 'test' 3375 return 'test'
3362 enddef 3376 enddef
3363 g:some#name = 'name' 3377 g:some#name = 'name'
3378 g:some#dict = {key: 'value'}
3364 3379
3365 def some#varargs(a1: string, ...l: list<string>): string 3380 def some#varargs(a1: string, ...l: list<string>): string
3366 return a1 .. l[0] .. l[1] 3381 return a1 .. l[0] .. l[1]
3367 enddef 3382 enddef
3368 END 3383 END
3372 var save_rtp = &rtp 3387 var save_rtp = &rtp
3373 exe 'set rtp^=' .. getcwd() .. '/Xdir' 3388 exe 'set rtp^=' .. getcwd() .. '/Xdir'
3374 3389
3375 assert_equal('test', g:some#gettest()) 3390 assert_equal('test', g:some#gettest())
3376 assert_equal('name', g:some#name) 3391 assert_equal('name', g:some#name)
3392 assert_equal('value', g:some#dict.key)
3377 g:some#other = 'other' 3393 g:some#other = 'other'
3378 assert_equal('other', g:some#other) 3394 assert_equal('other', g:some#other)
3379 3395
3380 assert_equal('abc', some#varargs('a', 'b', 'c')) 3396 assert_equal('abc', some#varargs('a', 'b', 'c'))
3381 3397