Search in sources :

Example 1 with LogNode

use of com.google.template.soy.soytree.LogNode in project closure-templates by google.

the class TemplateParserTest method testParseLogStmt.

@Test
public void testParseLogStmt() throws Exception {
    String templateBody = "{@param foo : ?}\n" + "{log}Blah {$foo}.{/log}";
    List<StandaloneNode> nodes = parseTemplateContent(templateBody, FAIL).getChildren();
    assertEquals(1, nodes.size());
    LogNode logNode = (LogNode) nodes.get(0);
    assertEquals(3, logNode.numChildren());
    assertEquals("Blah ", ((RawTextNode) logNode.getChild(0)).getRawText());
    assertEquals("$foo", ((PrintNode) logNode.getChild(1)).getExpr().toSourceString());
}
Also used : StandaloneNode(com.google.template.soy.soytree.SoyNode.StandaloneNode) LogNode(com.google.template.soy.soytree.LogNode) PrintNode(com.google.template.soy.soytree.PrintNode) Test(org.junit.Test)

Aggregations

LogNode (com.google.template.soy.soytree.LogNode)1 PrintNode (com.google.template.soy.soytree.PrintNode)1 StandaloneNode (com.google.template.soy.soytree.SoyNode.StandaloneNode)1 Test (org.junit.Test)1