mirror of
https://github.com/MorizzG/MLox.git
synced 2025-12-06 04:22:41 +00:00
updated tests for functions
This commit is contained in:
parent
b717b91ee5
commit
e1a8717d21
1 changed files with 61 additions and 21 deletions
82
lox.t/run.t
82
lox.t/run.t
|
|
@ -465,7 +465,10 @@ $ mlox for/closure_in_body.lox
|
||||||
|
|
||||||
|
|
||||||
file for/fun_in_body.lox
|
file for/fun_in_body.lox
|
||||||
$ mlox 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
|
file for/return_closure.lox
|
||||||
|
|
@ -517,15 +520,21 @@ file for/var_in_body.lox
|
||||||
[1]
|
[1]
|
||||||
|
|
||||||
file function/body_must_be_block.lox
|
file function/body_must_be_block.lox
|
||||||
$ mlox 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
|
file function/empty_body.lox
|
||||||
$ mlox function/empty_body.lox
|
$ mlox function/empty_body.lox
|
||||||
|
nil
|
||||||
|
|
||||||
|
|
||||||
file function/extra_arguments.lox
|
file function/extra_arguments.lox
|
||||||
$ mlox 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
|
file function/local_mutual_recursion.lox
|
||||||
|
|
@ -537,11 +546,16 @@ $ mlox function/local_recursion.lox
|
||||||
|
|
||||||
|
|
||||||
file function/missing_arguments.lox
|
file function/missing_arguments.lox
|
||||||
$ mlox 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
|
file function/missing_comma_in_parameters.lox
|
||||||
$ mlox 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
|
file function/mutual_recursion.lox
|
||||||
|
|
@ -557,7 +571,9 @@ $ mlox function/parameters.lox
|
||||||
|
|
||||||
|
|
||||||
file function/print.lox
|
file function/print.lox
|
||||||
$ mlox function/print.lox
|
$ mlox function/print.lox
|
||||||
|
<fn foo/0>
|
||||||
|
<native fn clock/0>
|
||||||
|
|
||||||
|
|
||||||
file function/recursion.lox
|
file function/recursion.lox
|
||||||
|
|
@ -565,11 +581,18 @@ $ mlox function/recursion.lox
|
||||||
|
|
||||||
|
|
||||||
file function/too_many_arguments.lox
|
file function/too_many_arguments.lox
|
||||||
$ mlox 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
|
file function/too_many_parameters.lox
|
||||||
$ mlox 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
|
file if/class_in_else.lox
|
||||||
|
|
@ -593,11 +616,17 @@ file if/else.lox
|
||||||
|
|
||||||
|
|
||||||
file if/fun_in_else.lox
|
file if/fun_in_else.lox
|
||||||
$ mlox 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
|
file if/fun_in_then.lox
|
||||||
$ mlox 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
|
file if/if.lox
|
||||||
|
|
@ -659,11 +688,11 @@ $ mlox inheritance/set_fields_from_base_class.lox
|
||||||
|
|
||||||
|
|
||||||
file limit/loop_too_large.lox
|
file limit/loop_too_large.lox
|
||||||
$ mlox limit/loop_too_large.lox
|
$ mlox limit/loop_too_large.lox
|
||||||
|
|
||||||
|
|
||||||
file limit/no_reuse_constants.lox
|
file limit/no_reuse_constants.lox
|
||||||
$ mlox limit/no_reuse_constants.lox
|
$ mlox limit/no_reuse_constants.lox
|
||||||
|
|
||||||
|
|
||||||
file limit/stack_overflow.lox
|
file limit/stack_overflow.lox
|
||||||
|
|
@ -671,15 +700,15 @@ $ mlox limit/stack_overflow.lox
|
||||||
|
|
||||||
|
|
||||||
file limit/too_many_constants.lox
|
file limit/too_many_constants.lox
|
||||||
$ mlox limit/too_many_constants.lox
|
$ mlox limit/too_many_constants.lox
|
||||||
|
|
||||||
|
|
||||||
file limit/too_many_locals.lox
|
file limit/too_many_locals.lox
|
||||||
$ mlox limit/too_many_locals.lox
|
$ mlox limit/too_many_locals.lox
|
||||||
|
|
||||||
|
|
||||||
file limit/too_many_upvalues.lox
|
file limit/too_many_upvalues.lox
|
||||||
$ mlox limit/too_many_upvalues.lox
|
$ mlox limit/too_many_upvalues.lox
|
||||||
|
|
||||||
|
|
||||||
file logical_operator/and.lox
|
file logical_operator/and.lox
|
||||||
|
|
@ -987,7 +1016,15 @@ file operator/negate_nonnum.lox
|
||||||
|
|
||||||
|
|
||||||
file operator/not.lox
|
file operator/not.lox
|
||||||
$ mlox operator/not.lox
|
$ mlox operator/not.lox
|
||||||
|
false
|
||||||
|
true
|
||||||
|
true
|
||||||
|
false
|
||||||
|
false
|
||||||
|
true
|
||||||
|
false
|
||||||
|
false
|
||||||
|
|
||||||
|
|
||||||
file operator/not_class.lox
|
file operator/not_class.lox
|
||||||
|
|
@ -1225,17 +1262,17 @@ $ mlox this/this_in_top_level_function.lox
|
||||||
|
|
||||||
|
|
||||||
file variable/collide_with_parameter.lox
|
file variable/collide_with_parameter.lox
|
||||||
$ mlox variable/collide_with_parameter.lox
|
$ mlox variable/collide_with_parameter.lox
|
||||||
|
|
||||||
|
|
||||||
file variable/duplicate_local.lox
|
file variable/duplicate_local.lox
|
||||||
$ mlox 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]
|
[1]
|
||||||
|
|
||||||
|
|
||||||
file variable/duplicate_parameter.lox
|
file variable/duplicate_parameter.lox
|
||||||
$ mlox variable/duplicate_parameter.lox
|
$ mlox variable/duplicate_parameter.lox
|
||||||
|
|
||||||
|
|
||||||
file variable/early_bound.lox
|
file variable/early_bound.lox
|
||||||
|
|
@ -1355,7 +1392,10 @@ $ mlox while/closure_in_body.lox
|
||||||
|
|
||||||
|
|
||||||
file while/fun_in_body.lox
|
file while/fun_in_body.lox
|
||||||
$ mlox 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
|
file while/return_closure.lox
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue