From f1679e83b7636f5ff980ff3a4985353dce43dfd9 Mon Sep 17 00:00:00 2001 From: greg Date: Mon, 4 Jun 2018 20:36:26 -0700 Subject: [PATCH] Start trying to fix tests --- schala-lang/src/eval.rs | 4 +++- schala-lang/src/typechecking.rs | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/schala-lang/src/eval.rs b/schala-lang/src/eval.rs index 053cb4d..d22dc5c 100644 --- a/schala-lang/src/eval.rs +++ b/schala-lang/src/eval.rs @@ -323,7 +323,9 @@ mod eval_tests { ($string:expr, $correct:expr) => { let symbol_table = Rc::new(RefCell::new(SymbolTable::new())); let mut state = State::new(symbol_table); - let all_output = state.evaluate(parse(tokenize($string)).0.unwrap().reduce(), true); + let ast = parse(tokenize($string)).0.unwrap(); + state.symbol_table_handle.borrow_mut().add_top_level_symbols(&ast); + let all_output = state.evaluate(ast.reduce(), true); let ref output = all_output.last().unwrap(); assert_eq!(**output, Ok($correct.to_string())); } diff --git a/schala-lang/src/typechecking.rs b/schala-lang/src/typechecking.rs index ac246ff..d42bb0f 100644 --- a/schala-lang/src/typechecking.rs +++ b/schala-lang/src/typechecking.rs @@ -469,11 +469,14 @@ mod tests { use super::{Type, TConst, TypeContext}; use super::Type::*; use super::TConst::*; + use std::rc::Rc; + use std::cell::RefCell; macro_rules! type_test { ($input:expr, $correct:expr) => { { - let mut tc = TypeContext::new(); + let symbol_table = Rc::new(RefCell::new(SymbolTable::new())); + let mut tc = TypeContext::new(symbol_table); let ast = ::ast::parse(::tokenizing::tokenize($input)).0.unwrap() ; //tc.add_symbols(&ast); assert_eq!($correct, tc.infer_block(&ast.0).unwrap())