This is an automated email from the ASF dual-hosted git repository. henrib pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-jexl.git
The following commit(s) were added to refs/heads/master by this push: new cd3db936 JEXL-403:unit test; cd3db936 is described below commit cd3db936723ca8e5c7bf68a62f23f15642ce992a Author: Henri Biestro <hbies...@cloudera.com> AuthorDate: Tue Aug 29 15:51:14 2023 +0200 JEXL-403:unit test; --- .../org/apache/commons/jexl3/Issues400Test.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/test/java/org/apache/commons/jexl3/Issues400Test.java b/src/test/java/org/apache/commons/jexl3/Issues400Test.java index 81d2a56c..4ddc2eac 100644 --- a/src/test/java/org/apache/commons/jexl3/Issues400Test.java +++ b/src/test/java/org/apache/commons/jexl3/Issues400Test.java @@ -61,4 +61,25 @@ public class Issues400Test { Assert.assertNull(o); } } + + @Test + public void test403() { + String src = "var a = {'a': 1};\n" + + "var list = [a, a];\n" + + "let map1 = {:};\n" + + "for (var item : list) {\n" + + " map1[`${item.a}`] = 1;\n" + + "}\n " + + "map1"; + final JexlEngine jexl = new JexlBuilder().create(); + JexlScript script = jexl.createScript(src); + for(int i = 0; i < 2; ++ i) { + Object result = script.execute(null); + Assert.assertTrue(result instanceof Map); + Map<?, ?> map = (Map<?, ?>) result; + Assert.assertEquals(1, map.size()); + Assert.assertTrue(map.containsKey(1)); + Assert.assertTrue(map.containsValue(1)); + } + } }