basic tests
This commit is contained in:
parent
e2478bfbf4
commit
fa808478ab
21
src/run.rs
21
src/run.rs
|
|
@ -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())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user