Add back another test revealing a scope error

This commit is contained in:
Greg Shuflin 2021-10-25 02:46:10 -07:00
parent df41da84b4
commit 8ceaa734d2
2 changed files with 26 additions and 0 deletions

View File

@ -2,6 +2,8 @@
## Symbols
* Add some good printf-debugging impls for SymbolTable-related items
* the symbol table should probably *only* be for global definitions (maybe rename it to reflect this?)
* dealing with variable lookup w/in functions/closures should probably happen in AST -> ReducedAST
* b/c that's where we go from a string name to a canonical ID (for e.g. 2nd param in 3rd enclosing scope)

View File

@ -62,3 +62,27 @@ fn scopes() {
eval_assert(scope_ok, "20");
}
#[test]
fn basic_lambda_evaluation_1() {
let source = r#"
let q = \(x, y) { x * y }
let x = q(5, 2)
let y = \(m, n, o) { m + n + o }(1,2,3)
(x, y)
"#;
eval_assert(source, r"(10, 6)");
}
#[test]
fn basic_lambda_evaluation_2() {
let source = r#"
fn milta() {
\(x) { x + 33 }
}
milta()(10)
"#;
eval_assert(source, "43");
}