mirror of
https://github.com/vim/vim.git
synced 2025-10-04 05:25:06 -04:00
patch 8.2.2645: using inline function is not properly tested
Problem: Using inline function is not properly tested. Solution: Add test cases, esp. for errors. Minor code improvements.
This commit is contained in:
@@ -1961,6 +1961,11 @@ def Test_expr7_lambda_block()
|
||||
return 'no'
|
||||
})
|
||||
assert_equal(['no', 'yes', 'no'], dll)
|
||||
|
||||
sandbox var Safe = (nr: number): number => {
|
||||
return nr + 7
|
||||
}
|
||||
assert_equal(10, Safe(3))
|
||||
END
|
||||
CheckDefAndScriptSuccess(lines)
|
||||
|
||||
@@ -1968,6 +1973,34 @@ def Test_expr7_lambda_block()
|
||||
map([1, 2], (k, v) => { redrawt })
|
||||
END
|
||||
CheckDefAndScriptFailure(lines, 'E488')
|
||||
|
||||
lines =<< trim END
|
||||
var Func = (nr: int) => {
|
||||
echo nr
|
||||
}
|
||||
END
|
||||
CheckDefAndScriptFailure(lines, 'E1010', 1)
|
||||
|
||||
lines =<< trim END
|
||||
var Func = (nr: number): int => {
|
||||
return nr
|
||||
}
|
||||
END
|
||||
CheckDefAndScriptFailure(lines, 'E1010', 1)
|
||||
|
||||
lines =<< trim END
|
||||
var Func = (nr: number): int => {
|
||||
return nr
|
||||
END
|
||||
CheckDefAndScriptFailure(lines, 'E1171', 1) # line nr is function start
|
||||
|
||||
lines =<< trim END
|
||||
vim9script
|
||||
var Func = (nr: number): int => {
|
||||
var ll =<< ENDIT
|
||||
nothing
|
||||
END
|
||||
CheckScriptFailure(lines, 'E1145: Missing heredoc end marker: ENDIT', 2)
|
||||
enddef
|
||||
|
||||
def NewLambdaWithComments(): func
|
||||
|
Reference in New Issue
Block a user