0
0
mirror of https://github.com/vim/vim.git synced 2025-10-03 05:14:07 -04:00

patch 8.2.3309: Vim9: divide by zero causes a crash

Problem:    Vim9: divide by zero causes a crash.
Solution:   Give an error message. (closes #8727)
This commit is contained in:
Bram Moolenaar
2021-08-07 15:50:23 +02:00
parent 6ce46b9963
commit fbeefb1b87
3 changed files with 34 additions and 5 deletions

View File

@@ -1348,7 +1348,7 @@ enddef
def Test_expr5_vim9script_channel()
if !has('channel')
MissingFeature 'float'
MissingFeature 'channel'
else
var lines =<< trim END
echo 'a' .. test_null_job()
@@ -1502,6 +1502,18 @@ def Test_expr6()
CheckDefExecAndScriptFailure(['echo 1 / 0'], 'E1154', 1)
CheckDefExecAndScriptFailure(['echo 1 % 0'], 'E1154', 1)
lines =<< trim END
var n = 0
eval 1 / n
END
CheckDefExecAndScriptFailure(lines, 'E1154', 2)
lines =<< trim END
var n = 0
eval 1 % n
END
CheckDefExecAndScriptFailure(lines, 'E1154', 2)
enddef
def Test_expr6_vim9script()