diff options
author | Jo-Philipp Wich <jo@mein.io> | 2020-11-03 23:43:01 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2020-11-04 00:02:31 +0100 |
commit | 940a89bd5cc1a04dbff4379b02d559982b4febd4 (patch) | |
tree | 729bd4ece11e03fbf1ada89a9739af52eb21e4d8 /tests/00_syntax/15_function_declarations | |
parent | e1b338ac200a7a8e1d156fbfd5517f562aaa9277 (diff) |
tests: add illegal syntax tests for rest arguments
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'tests/00_syntax/15_function_declarations')
-rw-r--r-- | tests/00_syntax/15_function_declarations | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/00_syntax/15_function_declarations b/tests/00_syntax/15_function_declarations index f02f90a..4257dd6 100644 --- a/tests/00_syntax/15_function_declarations +++ b/tests/00_syntax/15_function_declarations @@ -124,3 +124,41 @@ used in function call arguments to pass arrays of values as argument list. ]), "\n"); %} -- End -- + + +Rest arguments may be only used once in a declaration and they must always +be the last item in the argument list. + +-- Expect stderr -- +Syntax error: Unexpected token +Expecting ')' +In line 2, byte 26: + + ` function illegal(...args, ...args2) {}` + Near here ------------------^ + + +-- End -- + +-- Testcase -- +{% + function illegal(...args, ...args2) {} +%} +-- End -- + +-- Expect stderr -- +Syntax error: Unexpected token +Expecting ')' +In line 2, byte 26: + + ` function illegal(...args, a, b) {}` + Near here ------------------^ + + +-- End -- + +-- Testcase -- +{% + function illegal(...args, a, b) {} +%} +-- End -- |