Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.1
-
None
Description
The test cases in PragmaTest.java are now silently swallowing parsing exceptions of tests with antish pragma names. In fact we should report a test error if there is any exception caught during test run.
@Test public void testPragmas() throws Exception { JexlContext jc = new MapContext(); try { JexlScript script = JEXL.createScript("#pragma one 1\n#pragma the.very.hard 'truth'\n2;"); Assert.assertTrue(script != null); Map<String, Object> pragmas = script.getPragmas(); Assert.assertEquals(2, pragmas.size()); Assert.assertEquals(1, pragmas.get("one")); Assert.assertEquals("truth", pragmas.get("the.very.hard")); } catch (JexlException xjexl) { String s = xjexl.toString(); /* We need to add this to the test */ Assert.fail("Should not fail with: " + s); } }
As for the problem itself, now a jexl script will not parse correctly with pragmas specifying antish name, like the example specified in the documentation:
#pragma execution.option 42