Add test with &str parameter.

This commit is contained in:
Stephen Chung
2021-03-17 22:32:22 +08:00
parent 80c7e9310e
commit 1200ffcd2b
2 changed files with 18 additions and 10 deletions

View File

@@ -215,5 +215,13 @@ fn test_anonymous_fn() -> Result<(), Box<EvalAltResult>> {
assert_eq!(calc_func(42, "hello".to_string(), 9)?, 423);
let calc_func = Func::<(INT, &str, INT), INT>::create_from_script(
Engine::new(),
"fn calc(x, y, z) { (x + len(y)) * z }",
"calc",
)?;
assert_eq!(calc_func(42, "hello", 9)?, 423);
Ok(())
}