You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by he...@apache.org on 2019/11/01 11:00:44 UTC
[commons-jexl] branch master updated: JEXL-307: test cleanup Task
#JEXL-307 - Variable redeclaration option
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 ae819a2 JEXL-307: test cleanup Task #JEXL-307 - Variable redeclaration option
ae819a2 is described below
commit ae819a2c7cb89a50e69a056a8b8b01a49b82110d
Author: henrib <he...@apache.org>
AuthorDate: Fri Nov 1 11:59:54 2019 +0100
JEXL-307: test cleanup
Task #JEXL-307 - Variable redeclaration option
---
.../java/org/apache/commons/jexl3/LexicalTest.java | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/src/test/java/org/apache/commons/jexl3/LexicalTest.java b/src/test/java/org/apache/commons/jexl3/LexicalTest.java
index 0a6d7cf..d14add0 100644
--- a/src/test/java/org/apache/commons/jexl3/LexicalTest.java
+++ b/src/test/java/org/apache/commons/jexl3/LexicalTest.java
@@ -227,32 +227,25 @@ public class LexicalTest {
@Test
public void testLexical2() throws Exception {
- JexlEngine jexl = new JexlBuilder().strict(true).create();
+ JexlEngine jexl = new JexlBuilder().strict(true).lexical(true).create();
JexlEvalContext ctxt = new JexlEvalContext();
- JexlOptions options = ctxt.getEngineOptions();
- // ensure errors will throw
- options.setLexical(true);
JexlScript script = jexl.createScript("{var x = 42}; {var x; return x; }");
- try {
- Object result = script.execute(ctxt);
- Assert.assertNull(result);
- } catch (JexlException xany) {
- String ww = xany.toString();
- }
+ Object result = script.execute(ctxt);
+ Assert.assertNull(result);
}
@Test
public void testLexical3() throws Exception {
String str = "var s = {}; for (var i : [1]) s.add(i); s";
- JexlEngine jexl = new JexlBuilder().strict(true).create();
+ JexlEngine jexl = new JexlBuilder().strict(true).lexical(true).create();
JexlScript e = jexl.createScript(str);
JexlContext jc = new MapContext();
Object o = e.execute(jc);
- Assert.assertEquals(Boolean.TRUE, ((Set)o).contains(1));
+ Assert.assertTrue(((Set)o).contains(1));
e = jexl.createScript(str);
o = e.execute(jc);
- Assert.assertEquals(Boolean.TRUE, ((Set)o).contains(1));
+ Assert.assertTrue(((Set)o).contains(1));
}
}