summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--tests/00_syntax/15_function_declarations38
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 --