forked from aniani/vim
patch 9.1.0415: Some functions are not tested
Problem: Some functions are not tested
Solution: Add a few more tests, fix a few minor problems
(Yegappan Lakshmanan)
closes: #14789
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
e595e9c31b
commit
fe424d13ef
@@ -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
|
||||
@@ -2152,6 +2161,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()
|
||||
|
||||
Reference in New Issue
Block a user