rhai/tests/unit.rs
2022-12-30 18:07:39 +01:00

25 lines
563 B
Rust

use rhai::{Engine, EvalAltResult};
#[test]
fn test_unit() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
engine.run("let x = (); x")?;
Ok(())
}
#[test]
fn test_unit_eq() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
assert!(engine
.eval::<bool>("let x = (); let y = (); x == y")
.unwrap());
Ok(())
}
#[test]
fn test_unit_with_spaces() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
let _ = engine.run("let x = ( ); x").expect_err("should error");
Ok(())
}