2020-03-02 15:11:56 +01:00
|
|
|
use rhai::{Engine, EvalAltResult};
|
2018-05-23 01:44:41 +02:00
|
|
|
|
|
|
|
#[test]
|
2020-03-02 15:11:56 +01:00
|
|
|
fn test_unit() -> Result<(), EvalAltResult> {
|
2018-05-23 01:44:41 +02:00
|
|
|
let mut engine = Engine::new();
|
2020-03-24 09:57:35 +01:00
|
|
|
engine.eval::<()>("let x = (); x")?;
|
2020-03-02 15:11:56 +01:00
|
|
|
Ok(())
|
2018-05-23 01:44:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
2020-03-02 15:11:56 +01:00
|
|
|
fn test_unit_eq() -> Result<(), EvalAltResult> {
|
2018-05-23 01:44:41 +02:00
|
|
|
let mut 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]
|
2020-03-02 15:11:56 +01:00
|
|
|
fn test_unit_with_spaces() -> Result<(), EvalAltResult> {
|
2018-05-23 01:44:41 +02:00
|
|
|
let mut engine = Engine::new();
|
2020-03-24 09:57:35 +01:00
|
|
|
engine.eval::<()>("let x = ( ); x")?;
|
2020-03-02 15:11:56 +01:00
|
|
|
Ok(())
|
2018-06-13 10:56:29 +02:00
|
|
|
}
|