rhai/tests/unit.rs

23 lines
537 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();
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();
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(())
}