rhai/tests/unit.rs

23 lines
512 B
Rust
Raw Normal View History

2020-03-02 15:11:56 +01:00
use rhai::{Engine, EvalAltResult};
2018-05-23 01:44:41 +02:00
#[test]
fn test_unit() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
2022-01-10 06:26:33 +01:00
engine.run("let x = (); x")?;
2020-03-02 15:11:56 +01:00
Ok(())
2018-05-23 01:44:41 +02:00
}
#[test]
fn test_unit_eq() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
2020-03-02 15:11:56 +01:00
assert_eq!(engine.eval::<bool>("let x = (); let y = (); x == y")?, true);
Ok(())
2018-05-23 01:44:41 +02:00
}
#[test]
fn test_unit_with_spaces() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
2022-01-10 06:26:33 +01:00
engine.run("let x = ( ); x")?;
2020-03-02 15:11:56 +01:00
Ok(())
}