summaryrefslogtreecommitdiffstats
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.vim16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_expr.vim b/src/testdir/test_vim9_expr.vim
index 7764b37..5734731 100644
--- a/src/testdir/test_vim9_expr.vim
+++ b/src/testdir/test_vim9_expr.vim
@@ -309,6 +309,9 @@ def Test_expr2()
g:vals = [1]
endif
assert_equal([1], g:vals)
+
+ # string interpolation with ||
+ assert_equal('true', $"{0 || 1}")
END
v9.CheckDefAndScriptSuccess(lines)
@@ -415,6 +418,7 @@ def Test_expr2_fails()
v9.CheckDefExecAndScriptFailure(['var x = 3', 'if x', 'endif'], 'E1023:', 2)
v9.CheckDefAndScriptFailure(["var x = [] || false"], ['E1012: Type mismatch; expected bool but got list<any>', 'E745:'], 1)
+ v9.CheckDefAndScriptFailure(["var x = $'{false || []}'"], ['E1012: Type mismatch; expected bool but got list<any>', 'E745:'], 1)
var lines =<< trim END
vim9script
@@ -475,6 +479,9 @@ def Test_expr3()
failed = true
endif
assert_false(failed)
+
+ # string interpolation with &&
+ assert_equal('false', $"{1 && 0}")
END
v9.CheckDefAndScriptSuccess(lines)
enddef
@@ -574,6 +581,8 @@ def Test_expr3_fails()
echo true && s
END
v9.CheckDefAndScriptFailure(lines, ['E1012: Type mismatch; expected bool but got string', 'E1135: Using a String as a Bool: "asdf"'])
+
+ v9.CheckDefAndScriptFailure(["var x = $'{true && []}'"], ['E1012: Type mismatch; expected bool but got list<any>', 'E745:'], 1)
enddef
" global variables to use for tests with the "any" type
@@ -2109,6 +2118,12 @@ def Test_expr9_number()
Test()
END
v9.CheckDefAndScriptSuccess(lines)
+
+ lines =<< trim END
+ vim9script
+ eval("10\n")
+ END
+ v9.CheckSourceScriptFailure(lines, "E488: Trailing characters: \n")
enddef
def Test_expr9_float()
@@ -2152,6 +2167,7 @@ def Test_expr9_blob()
v9.CheckDefAndScriptSuccess(lines)
v9.CheckDefAndScriptFailure(["var x = 0z123"], 'E973:', 1)
+ v9.CheckDefAndScriptFailure(["var x = null_blox"], ['E1001:', 'E121:'], 1)
enddef
def Test_expr9_string()