Autocurry fixes and test

This commit is contained in:
Ilya Lakhin
2020-07-29 18:52:54 +07:00
parent 8e51988b66
commit 48356abc83
2 changed files with 48 additions and 56 deletions

View File

@@ -211,22 +211,26 @@ fn test_fn_ptr_curry_call() -> Result<(), Box<EvalAltResult>> {
}
#[test]
#[cfg(not(feature = "no_closures"))]
fn test_fn_closures() -> Result<(), Box<EvalAltResult>> {
let mut engine = Engine::new();
let engine = Engine::new();
let res = engine.eval::<INT>(
r#"
let x = 100;
assert_eq!(
engine.eval::<INT>(
r#"
let x = 8;
let f = || x;
let res = |y, z| {
let w = 12;
let x = 200;
return (|| x + y + z + w).call();
}.curry(15).call(2);
f.call()
"#
).unwrap();
panic!("{:#?}", res);
res + (|| x - 3).call()
"#
)?,
42
);
Ok(())
}