Add test for capturing closures in array method.
This commit is contained in:
parent
b7b42e658a
commit
dc7444596b
@ -184,6 +184,10 @@ fn test_arrays_map_reduce() -> Result<(), Box<EvalAltResult>> {
|
|||||||
|
|
||||||
assert_eq!(engine.eval::<INT>("[1].map(|x| x + 41)[0]")?, 42);
|
assert_eq!(engine.eval::<INT>("[1].map(|x| x + 41)[0]")?, 42);
|
||||||
assert_eq!(engine.eval::<INT>("([1].map(|x| x + 41))[0]")?, 42);
|
assert_eq!(engine.eval::<INT>("([1].map(|x| x + 41))[0]")?, 42);
|
||||||
|
assert_eq!(
|
||||||
|
engine.eval::<INT>("let c = 40; let y = 1; [1].map(|x, i| c + x + y + i)[0]")?,
|
||||||
|
42
|
||||||
|
);
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
engine
|
engine
|
||||||
|
Loading…
Reference in New Issue
Block a user