[go: up one dir, main page]

rhai 0.19.11

Embedded scripting for Rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use rhai::{Engine, EvalAltResult};

#[test]
fn test_not() -> Result<(), Box<EvalAltResult>> {
    let engine = Engine::new();

    assert_eq!(
        engine.eval::<bool>("let not_true = !true; not_true")?,
        false
    );

    #[cfg(not(feature = "no_function"))]
    assert_eq!(engine.eval::<bool>("fn not(x) { !x } not(false)")?, true);

    assert_eq!(engine.eval::<bool>("!!!!true")?, true);

    Ok(())
}