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