rhai/tests/unit.rs

23 lines
523 B
Rust
Raw Permalink 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();
2023-02-13 01:59:58 +01:00
assert!(engine.eval::<bool>("let x = (); let y = (); x == y")?);
2020-03-02 15:11:56 +01:00
Ok(())
2018-05-23 01:44:41 +02:00
}
#[test]
fn test_unit_with_spaces() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
2023-04-10 17:23:59 +02:00
let _ = engine.run("let x = ( ); x").unwrap_err();
2020-03-02 15:11:56 +01:00
Ok(())
}