-
Notifications
You must be signed in to change notification settings - Fork 173
Expand file tree
/
Copy pathEagerAstRangeBracketTest.java
More file actions
47 lines (41 loc) · 1.55 KB
/
EagerAstRangeBracketTest.java
File metadata and controls
47 lines (41 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.hubspot.jinjava.el.ext.eager;
import static org.assertj.core.api.Assertions.assertThat;
import com.hubspot.jinjava.BaseInterpretingTest;
import com.hubspot.jinjava.BaseJinjavaTest;
import com.hubspot.jinjava.JinjavaConfig;
import com.hubspot.jinjava.LegacyOverrides;
import com.hubspot.jinjava.interpret.Context;
import com.hubspot.jinjava.interpret.DeferredValue;
import com.hubspot.jinjava.interpret.JinjavaInterpreter;
import com.hubspot.jinjava.mode.EagerExecutionMode;
import com.hubspot.jinjava.random.RandomNumberGeneratorStrategy;
import org.junit.Before;
import org.junit.Test;
public class EagerAstRangeBracketTest extends BaseInterpretingTest {
@Before
public void setup() {
JinjavaConfig config = BaseJinjavaTest
.newConfigBuilder()
.withRandomNumberGeneratorStrategy(RandomNumberGeneratorStrategy.DEFERRED)
.withExecutionMode(EagerExecutionMode.instance())
.withNestedInterpretationEnabled(true)
.withLegacyOverrides(
LegacyOverrides.newBuilder().withUsePyishObjectMapper(true).build()
)
.withMaxMacroRecursionDepth(5)
.withEnableRecursiveMacroCalls(true)
.build();
JinjavaInterpreter parentInterpreter = new JinjavaInterpreter(
jinjava,
new Context(),
config
);
interpreter = new JinjavaInterpreter(parentInterpreter);
interpreter.getContext().put("deferred", DeferredValue.instance());
}
@Test
public void itHandlesNullRangePrefix() {
assertThat(interpreter.render("{{ deferred[:100] }}"))
.isEqualTo("{{ deferred[:100] }}");
}
}