From d57a8045a92d93d440aa1c6988d0761974892411 Mon Sep 17 00:00:00 2001 From: greg Date: Tue, 16 Oct 2018 04:11:18 -0700 Subject: [PATCH] Rename test helper --- schala-lang/src/eval.rs | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/schala-lang/src/eval.rs b/schala-lang/src/eval.rs index a6ce53c..17daee1 100644 --- a/schala-lang/src/eval.rs +++ b/schala-lang/src/eval.rs @@ -442,7 +442,7 @@ mod eval_tests { } } - macro_rules! fresh_env { + macro_rules! test_in_fresh_env { ($string:expr, $correct:expr) => { { let all_output = all_output!($string); @@ -454,16 +454,16 @@ mod eval_tests { #[test] fn test_basic_eval() { - fresh_env!("1 + 2", "3"); - fresh_env!("let mut a = 1; a = 2", "Unit"); - fresh_env!("let mut a = 1; a = 2; a", "2"); - fresh_env!(r#"("a", 1 + 2)"#, r#"("a", 3)"#); + test_in_fresh_env!("1 + 2", "3"); + test_in_fresh_env!("let mut a = 1; a = 2", "Unit"); + test_in_fresh_env!("let mut a = 1; a = 2; a", "2"); + test_in_fresh_env!(r#"("a", 1 + 2)"#, r#"("a", 3)"#); } #[test] fn function_eval() { - fresh_env!("fn oi(x) { x + 1 }; oi(4)", "5"); - fresh_env!("fn oi(x) { x + 1 }; oi(1+2)", "4"); + test_in_fresh_env!("fn oi(x) { x + 1 }; oi(4)", "5"); + test_in_fresh_env!("fn oi(x) { x + 1 }; oi(1+2)", "4"); } #[test] @@ -476,7 +476,7 @@ mod eval_tests { } haha() "#; - fresh_env!(scope_ok, "10"); + test_in_fresh_env!(scope_ok, "10"); let scope_ok = r#" let a = 20 fn haha() { @@ -485,7 +485,7 @@ mod eval_tests { } a "#; - fresh_env!(scope_ok, "20"); + test_in_fresh_env!(scope_ok, "20"); } #[test] @@ -493,12 +493,12 @@ mod eval_tests { let source = r#" type Option = Some(T) | None let x = Some(9); if x is Some(q) then { q } else { 0 }"#; - fresh_env!(source, "9"); + test_in_fresh_env!(source, "9"); let source = r#" type Option = Some(T) | None let x = None; if x is Some(q) then { q } else { 0 }"#; - fresh_env!(source, "0"); + test_in_fresh_env!(source, "0"); } #[test] @@ -508,25 +508,25 @@ type Option = Some(T) | None let a = None if a { is None -> 4, is Some(x) -> x } "#; - fresh_env!(source, "4"); + test_in_fresh_env!(source, "4"); let source = r#" type Option = Some(T) | None let a = Some(99) if a { is None -> 4, is Some(x) -> x } "#; - fresh_env!(source, "99"); + test_in_fresh_env!(source, "99"); let source = r#" let a = 10 if a { is 10 -> "x", is 4 -> "y" } "#; - fresh_env!(source, "\"x\""); + test_in_fresh_env!(source, "\"x\""); let source = r#" let a = 10 if a { is 15 -> "x", is 10 -> "y" } "#; - fresh_env!(source, "\"y\""); + test_in_fresh_env!(source, "\"y\""); } }