diff options
Diffstat (limited to 'users/tazjin/rlox/src/interpreter')
-rw-r--r-- | users/tazjin/rlox/src/interpreter/tests.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/users/tazjin/rlox/src/interpreter/tests.rs b/users/tazjin/rlox/src/interpreter/tests.rs index 93a025c5e832..bf2cf61b0a76 100644 --- a/users/tazjin/rlox/src/interpreter/tests.rs +++ b/users/tazjin/rlox/src/interpreter/tests.rs @@ -70,3 +70,18 @@ fn test_binary_operators() { parse_eval(&code("\"foo\" + \"bar\";")) ); } + +#[test] +fn test_functions() { + let code = code( + r#" +fun add(a, b, c) { + a + b + c; +} + +add(1, 2, 3); +"#, + ); + + assert_eq!(Value::Literal(Literal::Number(6.0)), parse_eval(&code)); +} |