diff options
Diffstat (limited to 'src/testdir/test_vim9_expr.vim')
-rw-r--r-- | src/testdir/test_vim9_expr.vim | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_expr.vim b/src/testdir/test_vim9_expr.vim index 44ff105c62..0e0e34e01e 100644 --- a/src/testdir/test_vim9_expr.vim +++ b/src/testdir/test_vim9_expr.vim @@ -282,6 +282,20 @@ def Test_expr2() g:vals = [] assert_equal(false, Record(0) || Record(false) || Record(0)) assert_equal([0, false, 0], g:vals) + + g:vals = [] + var x = 1 + if x || true + g:vals = [1] + endif + assert_equal([1], g:vals) + + g:vals = [] + x = 3 + if true || x + g:vals = [1] + endif + assert_equal([1], g:vals) END CheckDefAndScriptSuccess(lines) enddef @@ -357,6 +371,9 @@ def Test_expr2_fails() # TODO: should fail at compile time call CheckDefExecAndScriptFailure(["var x = 3 || 7"], 'E1023:', 1) + call CheckDefAndScriptFailure(["if 3"], 'E1023:', 1) + call CheckDefExecAndScriptFailure(['var x = 3', 'if x', 'endif'], 'E1023:', 2) + call CheckDefAndScriptFailure2(["var x = [] || false"], 'E1012: Type mismatch; expected bool but got list<unknown>', 'E745:', 1) enddef |