#![cfg(test)] use crate::symbol_table::SymbolTable; use super::*; fn build_ir(input: &str) -> ReducedIR { let ast = crate::util::quick_ast(input); let mut symbol_table = SymbolTable::new(); symbol_table.process_ast(&ast).unwrap(); let reduced = reduce(&ast, &symbol_table); reduced.debug(&symbol_table); reduced } #[test] fn test_ir() { let src = r#" let global_one = 10 + 20 let global_two = "the string hello" fn a_function(i, j, k) { fn nested(x) { x + 10 } i + j * nested(k) } fn another_function(e) { let local_var = 420 e * local_var } another_function() "#; let reduced = build_ir(src); assert!(1 == 2); }