summaryrefslogtreecommitdiff
path: root/src/testdir/test_vim9_expr.vim
diff options
context:
space:
mode:
Diffstat (limited to 'src/testdir/test_vim9_expr.vim')
-rw-r--r--src/testdir/test_vim9_expr.vim17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/testdir/test_vim9_expr.vim b/src/testdir/test_vim9_expr.vim
index cd5f15207..729e77a0f 100644
--- a/src/testdir/test_vim9_expr.vim
+++ b/src/testdir/test_vim9_expr.vim
@@ -1848,8 +1848,12 @@ def Test_expr6()
v9.CheckDefFailure(["var d = 6 * "], 'E1097:', 3)
v9.CheckScriptFailure(['vim9script', "var d = 6 * "], 'E15:', 2)
- v9.CheckDefExecAndScriptFailure(['echo 1 / 0'], 'E1154', 1)
- v9.CheckDefExecAndScriptFailure(['echo 1 % 0'], 'E1154', 1)
+ v9.CheckDefAndScriptFailure(['echo 1 / 0'], 'E1154', 1)
+ v9.CheckDefAndScriptFailure(['echo 1 % 0'], 'E1154', 1)
+
+ g:zero = 0
+ v9.CheckDefExecFailure(['echo 123 / g:zero'], 'E1154: Divide by zero')
+ v9.CheckDefExecFailure(['echo 123 % g:zero'], 'E1154: Divide by zero')
if has('float')
v9.CheckDefExecAndScriptFailure([
@@ -3399,6 +3403,15 @@ def Test_expr8_legacy_script()
lines =<< trim END
vim9script
def GetNumber(): number
+ legacy return notexists
+ enddef
+ echo GetNumber()
+ END
+ v9.CheckScriptFailure(lines, 'E121: Undefined variable: notexists')
+
+ lines =<< trim END
+ vim9script
+ def GetNumber(): number
legacy return range(3)->map('v:val + 1')
enddef
echo GetNumber()