Package com.google.template.soy.soytree

Examples of com.google.template.soy.soytree.SoyFileSetNode


  }


  private void applyCheckFunctionCallsVisitor(String soyContent, boolean allowExterns)
      throws Exception {
    SoyFileSetNode fileSet = SharedTestUtils.parseSoyFiles(soyContent);
    Map<String, SoyFunction> soyFunctions = ImmutableMap.<String, SoyFunction>of(
        "min",
        new SoyFunction() {
          public @Override String getName() {
            return "min";
View Full Code Here


    assertValidSoyCode("{msg desc=\"\"}{call .helper phname=\"foo\" /}{/msg}");
  }


  private void assertValidSoyCode(String soyCode) {
    SoyFileSetNode soyTree = SharedTestUtils.parseSoyCode(soyCode);
    (new VerifyPhnameAttrOnlyOnPlaceholdersVisitor()).exec(soyTree);
  }
View Full Code Here

  }


  private void assertInvalidSoyCode(String soyCode) {

    SoyFileSetNode soyTree = SharedTestUtils.parseSoyCode(soyCode);
    try {
      (new VerifyPhnameAttrOnlyOnPlaceholdersVisitor()).exec(soyTree);
      fail();
    } catch (SoySyntaxException sse) {
      assertTrue(sse.getMessage().contains("Found 'phname' attribute not on a msg placeholder"));
View Full Code Here

    String callCode =
        "{call .foo}\n" +
        "  {param xxx: $xxx /}\n" +
        "  {param yyyZzz: $yyyZzz /}\n" +
        "{/call}\n";
    SoyFileSetNode soyTree = SharedTestUtils.parseSoyCode(callCode);
    (new ChangeCallsToPassAllDataVisitor()).exec(soyTree);
    assertEquals(
        "{call .foo data=\"all\" /}",
        SharedTestUtils.getNode(soyTree, 0).toSourceString());
View Full Code Here

  }


  private void testUnchangedCallHelper(String callCode) throws Exception {

    SoyFileSetNode soyTree = SharedTestUtils.parseSoyCode(callCode);
    CallNode callNodeBeforePass = (CallNode) SharedTestUtils.getNode(soyTree, 0);
    callNodeBeforePass.setEscapingDirectiveNames(ImmutableList.of("|escapeHtml"));
    (new ChangeCallsToPassAllDataVisitor()).exec(soyTree);
    CallNode callNodeAfterPass = (CallNode) SharedTestUtils.getNode(soyTree, 0);
    assertEquals(callNodeBeforePass, callNodeAfterPass);
View Full Code Here

        "{foreach $xxx in $xxxs}\n" +
        "  {call .foo}\n" // should not be changed (param references loop var)
        "    {param xxx: $xxx /}\n" +
        "  {/call}\n" +
        "{/foreach}";
    SoyFileSetNode soyTree = SharedTestUtils.parseSoyCode(soyCode);

    CallNode callNodeOutsideLoopBeforePass = (CallNode) SharedTestUtils.getNode(soyTree, 0);
    CallNode callNodeInsideLoopBeforePass = (CallNode) SharedTestUtils.getNode(soyTree, 1, 0, 0);
    (new ChangeCallsToPassAllDataVisitor()).exec(soyTree);
    CallNode callNodeOutsideLoopAfterPass = (CallNode) SharedTestUtils.getNode(soyTree, 0);
View Full Code Here

            "{/template}\n");
  }


  private void assertValidSoyFiles(String... soyFileContents) {
    SoyFileSetNode soyTree = SharedTestUtils.parseSoyFiles(soyFileContents);
    (new CheckSoyDocVisitor(false)).exec(soyTree);
    (new CheckCallsVisitor()).exec(soyTree);
  }
View Full Code Here

  }


  private void assertInvalidSoyFiles(String expectedErrorMsgSubstr, String... soyFileContents) {

    SoyFileSetNode soyTree = SharedTestUtils.parseSoyFiles(soyFileContents);
    (new CheckSoyDocVisitor(false)).exec(soyTree);
    try {
      (new CheckCallsVisitor()).exec(soyTree);
    } catch (SoySyntaxException sse) {
      assertTrue(sse.getMessage().contains(expectedErrorMsgSubstr));
View Full Code Here

            "{/deltemplate}");
  }


  private void assertValidSoyFiles(String... soyFileContents) {
    SoyFileSetNode soyTree = SharedTestUtils.parseSoyFiles(soyFileContents);
    (new CheckSoyDocVisitor(false)).exec(soyTree);
    (new CheckDelegatesVisitor()).exec(soyTree);
  }
View Full Code Here

  }


  private void assertInvalidSoyFiles(String expectedErrorMsgSubstr, String... soyFileContents) {

    SoyFileSetNode soyTree = SharedTestUtils.parseSoyFiles(soyFileContents);
    (new CheckSoyDocVisitor(false)).exec(soyTree);
    try {
      (new CheckDelegatesVisitor()).exec(soyTree);
    } catch (SoySyntaxException sse) {
      assertTrue(
View Full Code Here

TOP

Related Classes of com.google.template.soy.soytree.SoyFileSetNode

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.