Code refactor, bug fixes, code docs.
This commit is contained in:
14
tests/engine.rs
Normal file
14
tests/engine.rs
Normal file
@@ -0,0 +1,14 @@
|
||||
use rhai::{Engine, EvalAltResult};
|
||||
|
||||
#[test]
|
||||
fn test_engine_call_fn() -> Result<(), EvalAltResult> {
|
||||
let mut engine = Engine::new();
|
||||
|
||||
let ast = Engine::compile("fn hello(x, y) { x.len() + y }")?;
|
||||
|
||||
let result: i64 = engine.call_fn("hello", ast, (&mut String::from("abc"), &mut 123_i64))?;
|
||||
|
||||
assert_eq!(result, 126);
|
||||
|
||||
Ok(())
|
||||
}
|
Reference in New Issue
Block a user