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 2022/12/23 16:22:01 UTC

[commons-jexl] branch JEXL-390 updated: JEXL-390: added Dmitri inspired test;

This is an automated email from the ASF dual-hosted git repository.

henrib pushed a commit to branch JEXL-390
in repository https://gitbox.apache.org/repos/asf/commons-jexl.git


The following commit(s) were added to refs/heads/JEXL-390 by this push:
     new 465ff25e JEXL-390: added Dmitri inspired test;
465ff25e is described below

commit 465ff25e7d23bc297ea985ab9f4cd54db6e114a7
Author: henrib <he...@apache.org>
AuthorDate: Fri Dec 23 17:21:55 2022 +0100

    JEXL-390: added Dmitri inspired test;
---
 src/test/java/org/apache/commons/jexl3/PragmaTest.java | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/test/java/org/apache/commons/jexl3/PragmaTest.java b/src/test/java/org/apache/commons/jexl3/PragmaTest.java
index 4bd306aa..602465af 100644
--- a/src/test/java/org/apache/commons/jexl3/PragmaTest.java
+++ b/src/test/java/org/apache/commons/jexl3/PragmaTest.java
@@ -158,7 +158,20 @@ public class PragmaTest extends JexlTestCase {
         String parsed = script.getParsedText();
         Assert.assertEquals(src, parsed);
     }
-
+    @Test
+    public void testPragmaOptions1() {
+        final String str = "i; #pragma jexl.options '-strict'\n";
+        final JexlEngine jexl = new JexlBuilder()
+                .features(new JexlFeatures().pragmaAnywhere(false))
+                .strict(true).create();
+        final JexlContext ctxt = new MapContext();
+        try {
+            final JexlScript e = jexl.createScript(str);
+            Assert.fail("i should not be resolved");
+        } catch (final JexlException xany) {
+            Assert.assertNotNull(xany);
+        }
+    }
     @Test
     public void testImportPragmaDisabled() {
         String src =