diff src/testdir/test_vim9_script.vim @ 28156:088d8dc22045 v8.2.4602

patch 8.2.4602: Vim9: not enough test coverage for executing :def function Commit: https://github.com/vim/vim/commit/397a87ac1c9857eb0d5ec3add69e3b9ab6b0c77c Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 20 21:14:15 2022 +0000 patch 8.2.4602: Vim9: not enough test coverage for executing :def function Problem: Vim9: not enough test coverage for executing :def function. Solution: Add a few more tests. Fix uncovered problem. Remove dead code.
author Bram Moolenaar <Bram@vim.org>
date Sun, 20 Mar 2022 22:15:02 +0100
parents ae975c8d5438
children 22c8cafe8c9c
line wrap: on
line diff
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -1246,6 +1246,37 @@ def Test_cexpr_vimscript()
       assert_equal(19, getqflist()[0].lnum)
   END
   v9.CheckScriptSuccess(lines)
+
+  lines =<< trim END
+      vim9script
+      def CexprFail()
+        au QuickfixCmdPre * echo g:doesnotexist
+        cexpr 'File otherFile line 99'
+        g:didContinue = 'yes'
+      enddef
+      CexprFail()
+      g:didContinue = 'also'
+  END
+  g:didContinue = 'no'
+  v9.CheckScriptFailure(lines, 'E121: Undefined variable: g:doesnotexist')
+  assert_equal('no', g:didContinue)
+  au! QuickfixCmdPre
+
+  lines =<< trim END
+      vim9script
+      def CexprFail()
+        cexpr g:aNumber
+        g:didContinue = 'yes'
+      enddef
+      CexprFail()
+      g:didContinue = 'also'
+  END
+  g:aNumber = 123
+  g:didContinue = 'no'
+  v9.CheckScriptFailure(lines, 'E777: String or List expected')
+  assert_equal('no', g:didContinue)
+  unlet g:didContinue
+
   set errorformat&
 enddef
 
@@ -1813,6 +1844,10 @@ def Test_echo_cmd()
   echo str1 str2
   assert_match('^some more$', g:Screenline(&lines))
 
+  echo "one\ntwo"
+  assert_match('^one$', g:Screenline(&lines - 1))
+  assert_match('^two$', g:Screenline(&lines))
+
   v9.CheckDefFailure(['echo "xxx"# comment'], 'E488:')
 enddef