updated tests for functions

This commit is contained in:
Moritz Gmeiner 2024-08-28 17:29:54 +02:00
commit e1a8717d21

View file

@ -466,6 +466,9 @@ $ mlox for/closure_in_body.lox
file for/fun_in_body.lox
$ mlox for/fun_in_body.lox
found 1 ParserError:
ParserError at line 2, column 9: Expected valid expression, got Fun instead
[1]
file for/return_closure.lox
@ -518,14 +521,20 @@ file for/var_in_body.lox
file function/body_must_be_block.lox
$ mlox function/body_must_be_block.lox
found 1 ParserError:
ParserError at line 3, column 8: Expected LeftBrace, but got (Number 123.)
[1]
file function/empty_body.lox
$ mlox function/empty_body.lox
nil
file function/extra_arguments.lox
$ mlox function/extra_arguments.lox
RuntimeError at line 6, column 1: Function f has arity 4, but was called with 2 args
[1]
file function/local_mutual_recursion.lox
@ -538,10 +547,15 @@ $ mlox function/local_recursion.lox
file function/missing_arguments.lox
$ mlox function/missing_arguments.lox
RuntimeError at line 3, column 1: Function f has arity 1, but was called with 2 args
[1]
file function/missing_comma_in_parameters.lox
$ mlox function/missing_comma_in_parameters.lox
found 1 ParserError:
ParserError at line 3, column 13: Expected RightParen, but got (Identifier "c")
[1]
file function/mutual_recursion.lox
@ -558,6 +572,8 @@ $ mlox function/parameters.lox
file function/print.lox
$ mlox function/print.lox
<fn foo/0>
<native fn clock/0>
file function/recursion.lox
@ -566,10 +582,17 @@ $ mlox function/recursion.lox
file function/too_many_arguments.lox
$ mlox function/too_many_arguments.lox
found 2 ParserErrors:
ParserError at line 4, column 5: Can't call with more than 255 arguments
ParserError at line 261, column 0: Expected valid expression, got RightBrace instead
[1]
file function/too_many_parameters.lox
$ mlox function/too_many_parameters.lox
found 1 ParserError:
ParserError at line 2, column 0: Function f can't have more than 255 arguments
[1]
file if/class_in_else.lox
@ -594,10 +617,16 @@ file if/else.lox
file if/fun_in_else.lox
$ mlox if/fun_in_else.lox
found 1 ParserError:
ParserError at line 2, column 21: Expected valid expression, got Fun instead
[1]
file if/fun_in_then.lox
$ mlox if/fun_in_then.lox
found 1 ParserError:
ParserError at line 2, column 10: Expected valid expression, got Fun instead
[1]
file if/if.lox
@ -988,6 +1017,14 @@ file operator/negate_nonnum.lox
file operator/not.lox
$ mlox operator/not.lox
false
true
true
false
false
true
false
false
file operator/not_class.lox
@ -1230,7 +1267,7 @@ $ mlox variable/collide_with_parameter.lox
file variable/duplicate_local.lox
$ mlox variable/duplicate_local.lox
RuntimeError at line 3, column 2: Tried to define a, but was already defined
RuntimeError at line 3, column 2: Tried to define a, but a variable of that name was already defined
[1]
@ -1356,6 +1393,9 @@ $ mlox while/closure_in_body.lox
file while/fun_in_body.lox
$ mlox while/fun_in_body.lox
found 1 ParserError:
ParserError at line 2, column 13: Expected valid expression, got Fun instead
[1]
file while/return_closure.lox