File tree Expand file tree Collapse file tree
src/test/java/com/hubspot/jinjava/tree Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -236,6 +236,28 @@ public void itEscapesValueWhenContextSet() throws Exception {
236236 assertThat (val ("{{ a }}" )).isEqualTo ("foo < bar" );
237237 }
238238
239+ @ Test
240+ public void itIgnoresParseErrorsWhenFeatureIsEnabled () {
241+ final JinjavaConfig config = JinjavaConfig
242+ .newBuilder ()
243+ .withFeatureConfig (
244+ FeatureConfig
245+ .newBuilder ()
246+ .add (JinjavaInterpreter .IGNORE_NESTED_INTERPRETATION_PARSE_ERRORS , c -> true )
247+ .build ()
248+ )
249+ .build ();
250+ JinjavaInterpreter interpreter = new Jinjava (config ).newInterpreter ();
251+ Context context = interpreter .getContext ();
252+ context .put ("myvar" , "hello {% if" );
253+ context .put ("place" , "world" );
254+
255+ ExpressionNode node = fixture ("simplevar" );
256+
257+ assertThat (node .render (interpreter ).toString ()).isEqualTo ("hello {% if" );
258+ assertThat (interpreter .getErrors ()).isEmpty ();
259+ }
260+
239261 private String val (String jinja ) {
240262 return parse (jinja ).render (interpreter ).getValue ();
241263 }
You can’t perform that action at this time.
0 commit comments