diff 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
line wrap: on
line diff
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -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)