rhai/tests/unit.rs

37 lines
669 B
Rust
Raw Normal View History

extern crate rhai;
use rhai::Engine;
2018-05-23 01:44:41 +02:00
#[test]
fn test_unit() {
let mut engine = Engine::new();
if let Ok(result) = engine.eval::<()>("let x = (); x") {
assert_eq!(result, ());
} else {
assert!(false);
}
}
#[test]
fn test_unit_eq() {
let mut engine = Engine::new();
if let Ok(result) = engine.eval::<bool>("let x = (); let y = (); x == y") {
assert!(result);
} else {
assert!(false);
}
}
#[test]
fn test_unit_with_spaces() {
let mut engine = Engine::new();
if let Ok(result) = engine.eval::<()>("let x = ( ); x") {
assert_eq!(result, ());
} else {
assert!(false);
}
}