Search in sources :

Example 26 with BufferingAppendable

use of com.google.template.soy.data.LoggingAdvisingAppendable.BufferingAppendable in project closure-templates by google.

the class AbstractLoggingAdvisingAppendableTest method testAppliesEscapersToPlaceholder.

@Test
public void testAppliesEscapersToPlaceholder() throws IOException {
    BufferingAppendable buffering = LoggingAdvisingAppendable.buffering();
    buffering.appendLoggingFunctionInvocation(LoggingFunctionInvocation.create("foo", "placeholder", ImmutableList.of()), ImmutableList.of(Functions.forMap(ImmutableMap.of("placeholder", "replacement"))));
    assertThat(buffering.toString()).isEqualTo("replacement");
}
Also used : BufferingAppendable(com.google.template.soy.data.LoggingAdvisingAppendable.BufferingAppendable) Test(org.junit.Test)

Example 27 with BufferingAppendable

use of com.google.template.soy.data.LoggingAdvisingAppendable.BufferingAppendable in project closure-templates by google.

the class AbstractLoggingAdvisingAppendableTest method testLogonly_logonly_before_regular.

@Test
public void testLogonly_logonly_before_regular() throws IOException {
    BufferingAppendable buffering = LoggingAdvisingAppendable.buffering();
    buffering.enterLoggableElement(LOGONLY);
    buffering.append("logonly");
    buffering.exitLoggableElement();
    buffering.enterLoggableElement(NOT_LOGONLY);
    buffering.append("hello");
    buffering.exitLoggableElement();
    assertThat(buffering.toString()).isEqualTo("hello");
}
Also used : BufferingAppendable(com.google.template.soy.data.LoggingAdvisingAppendable.BufferingAppendable) Test(org.junit.Test)

Aggregations

BufferingAppendable (com.google.template.soy.data.LoggingAdvisingAppendable.BufferingAppendable)27 Test (org.junit.Test)23 CompiledTemplate (com.google.template.soy.jbcsrc.shared.CompiledTemplate)14 CompiledTemplates (com.google.template.soy.jbcsrc.shared.CompiledTemplates)14 RenderContext (com.google.template.soy.jbcsrc.shared.RenderContext)13 RenderResult (com.google.template.soy.jbcsrc.api.RenderResult)6 LoggingAdvisingAppendable (com.google.template.soy.data.LoggingAdvisingAppendable)3 SoyRecord (com.google.template.soy.data.SoyRecord)3 SoyDict (com.google.template.soy.data.SoyDict)2 SettableFuture (com.google.common.util.concurrent.SettableFuture)1 TemplateMetadata (com.google.template.soy.jbcsrc.shared.TemplateMetadata)1 IOException (java.io.IOException)1