diff --git a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstIdentifier.java b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstIdentifier.java index c08be9afc..4fd63c7f8 100644 --- a/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstIdentifier.java +++ b/src/main/java/com/hubspot/jinjava/el/ext/eager/EagerAstIdentifier.java @@ -3,6 +3,7 @@ import com.hubspot.jinjava.el.ext.DeferredParsingException; import com.hubspot.jinjava.el.ext.ExtendedParser; import com.hubspot.jinjava.interpret.DeferredValueException; +import com.hubspot.jinjava.lib.exptest.ExpTest; import com.hubspot.jinjava.lib.filter.Filter; import com.hubspot.jinjava.util.EagerExpressionResolver; import de.odysseus.el.tree.Bindings; @@ -26,6 +27,7 @@ public Object eval(Bindings bindings, ELContext context) { !ExtendedParser.INTERPRETER.equals(getName()) && !EagerExpressionResolver.isPrimitive(result) && !(result instanceof Filter) && + !(result instanceof ExpTest) && EvalResultHolder .getJinjavaInterpreter(context) .getContext() diff --git a/src/test/java/com/hubspot/jinjava/EagerTest.java b/src/test/java/com/hubspot/jinjava/EagerTest.java index 65e71d0f7..e4c24f07d 100644 --- a/src/test/java/com/hubspot/jinjava/EagerTest.java +++ b/src/test/java/com/hubspot/jinjava/EagerTest.java @@ -1271,4 +1271,11 @@ public void itCorrectlyPreservesIdentifiersInMacroFunction() { "correctly-preserves-identifiers-in-macro-function" ); } + + @Test + public void itDoesNotPreserveFilterAndExpTestIdentifiers() { + expectedTemplateInterpreter.assertExpectedOutputNonIdempotent( + "does-not-preserve-filter-and-exp-test-identifiers" + ); + } } diff --git a/src/test/resources/eager/does-not-preserve-filter-and-exp-test-identifiers.expected.jinja b/src/test/resources/eager/does-not-preserve-filter-and-exp-test-identifiers.expected.jinja new file mode 100644 index 000000000..e6968b3ac --- /dev/null +++ b/src/test/resources/eager/does-not-preserve-filter-and-exp-test-identifiers.expected.jinja @@ -0,0 +1,2 @@ +{% set foo = ({'foo': 'bar'} , false, deferred) %} +{{ foo }} diff --git a/src/test/resources/eager/does-not-preserve-filter-and-exp-test-identifiers.jinja b/src/test/resources/eager/does-not-preserve-filter-and-exp-test-identifiers.jinja new file mode 100644 index 000000000..f872d562c --- /dev/null +++ b/src/test/resources/eager/does-not-preserve-filter-and-exp-test-identifiers.jinja @@ -0,0 +1,2 @@ +{% set foo = ('{"foo": "bar"}'|fromjson, 5 is gt 5, deferred) %} +{{ foo }}