Add test for capturing closures in array method.

This commit is contained in:
Stephen Chung 2021-11-23 22:56:31 +08:00
parent b7b42e658a
commit dc7444596b

View File

@ -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>("let c = 40; let y = 1; [1].map(|x, i| c + x + y + i)[0]")?,
42
);
assert_eq!(
engine