2020-03-02 15:11:56 +01:00
|
|
|
use rhai::{Engine, EvalAltResult};
|
2018-05-23 01:44:41 +02:00
|
|
|
|
|
|
|
#[test]
|
2020-04-21 17:25:12 +02:00
|
|
|
fn test_unit() -> Result<(), Box<EvalAltResult>> {
|
2020-04-07 07:23:06 +02:00
|
|
|
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]
|
2020-04-21 17:25:12 +02:00
|
|
|
fn test_unit_eq() -> Result<(), Box<EvalAltResult>> {
|
2020-04-07 07:23:06 +02:00
|
|
|
let engine = Engine::new();
|
2022-12-30 18:07:39 +01:00
|
|
|
assert!(engine
|
|
|
|
.eval::<bool>("let x = (); let y = (); x == y")
|
|
|
|
.unwrap());
|
2020-03-02 15:11:56 +01:00
|
|
|
Ok(())
|
2018-05-23 01:44:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
2020-04-21 17:25:12 +02:00
|
|
|
fn test_unit_with_spaces() -> Result<(), Box<EvalAltResult>> {
|
2020-04-07 07:23:06 +02:00
|
|
|
let engine = Engine::new();
|
2022-12-30 18:07:39 +01:00
|
|
|
let _ = engine.run("let x = ( ); x").expect_err("should error");
|
2020-03-02 15:11:56 +01:00
|
|
|
Ok(())
|
2018-06-13 10:56:29 +02:00
|
|
|
}
|