basic tests

This commit is contained in:
numzero 2025-04-11 19:48:30 +03:00
parent e2478bfbf4
commit fa808478ab

View File

@ -84,3 +84,24 @@ impl Eval for Expression {
} }
} }
} }
#[cfg(test)]
mod tests {
use super::*;
use crate::ast;
#[test]
fn test_consts() {
let mut scope = Scope::default();
assert_eq!(ast::Constant::Nil.eval(&mut scope), None);
assert_eq!(
ast::Constant::Boolean(true).eval(&mut scope),
Some(true.into())
);
assert_eq!(ast::Constant::Number(42).eval(&mut scope), Some(42.into()));
assert_eq!(
ast::Constant::String("foobar".into()).eval(&mut scope),
Some("foobar".into())
);
}
}