Lines
100 %
Functions
Branches
use nomiscript::{
Reader, eval_program,
runtime::{SymbolTable, Value},
};
fn eval_expr(code: &str) -> Result<Value, nomiscript::Error> {
let program = Reader::parse(code)?;
let mut symbols = SymbolTable::with_builtins();
eval_program(&mut symbols, &program)
}
#[test]
fn test_defstruct_creates_functions() {
let code = r"
(defstruct person name age)
T
";
let result = eval_expr(code);
assert!(result.is_ok(), "DEFSTRUCT should succeed and return T");
fn test_defstruct_constructor_exists() {
(quote (make-person))
assert!(result.is_ok(), "Constructor function should exist");