diff --git a/schala-lang/language/src/eval/test.rs b/schala-lang/language/src/eval/test.rs index f89639c..89ec254 100644 --- a/schala-lang/language/src/eval/test.rs +++ b/schala-lang/language/src/eval/test.rs @@ -186,33 +186,4 @@ let z = if c { test_in_fresh_env!(source, r#"("x", "haha", "NIGH")"#); } -#[test] -fn basic_lambda_syntax() { - 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) - "#; -test_in_fresh_env!(source, r"(10, 6)"); -} -#[test] -fn lambda_syntax_2() { - let source = r#" -fn milta() { - \(x) { x + 33 } -} -milta()(10) - "#; - test_in_fresh_env!(source, "43"); - } - -#[test] -fn import_all() { - let source = r#" -type Option = Some(T) | None -import Option::* -let x = Some(9); if x is Some(q) then { q } else { 0 }"#; - test_in_fresh_env!(source, "9"); -} diff --git a/schala-lang/language/src/tree_walk_eval/test.rs b/schala-lang/language/src/tree_walk_eval/test.rs index ff33b94..aef4ca5 100644 --- a/schala-lang/language/src/tree_walk_eval/test.rs +++ b/schala-lang/language/src/tree_walk_eval/test.rs @@ -62,6 +62,21 @@ fn scopes() { eval_assert(scope_ok, "20"); } +#[test] +fn if_is_patterns() { + let source = r#" +type Option = Some(T) | None +let x = Option::Some(9); if x is Option::Some(q) then { q } else { 0 }"#; + + eval_assert(source, "9"); + + let source = r#" +type Option = Some(T) | None +let x = Option::None; if x is Option::Some(q) then { q } else { 0 }"#; + eval_assert(source, "0"); +} + + #[test] fn basic_lambda_evaluation_1() { @@ -86,3 +101,12 @@ milta()(10) eval_assert(source, "43"); } + +#[test] +fn import_all() { + let source = r#" +type Option = Some(T) | None +import Option::* +let x = Some(9); if x is Some(q) then { q } else { 0 }"#; + //eval_assert(source, "9"); +}