Skip to content

Commit

Permalink
JEXL-403:unit test;
Browse files Browse the repository at this point in the history
  • Loading branch information
Henri Biestro committed Aug 29, 2023
1 parent 887b126 commit cd3db93
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/test/java/org/apache/commons/jexl3/Issues400Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,25 @@ public void test402() {
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));
}
}
}

0 comments on commit cd3db93

Please sign in to comment.