Package com.google.caja.render

Examples of com.google.caja.render.JsPrettyPrinter.noMoreTokens()


  public final void testRender() {
    StringBuilder sb = new StringBuilder();
    TokenConsumer tc = new JsPrettyPrinter(sb);
    root.render(new RenderContext(tc));
    tc.noMoreTokens();
    assertEquals(
        "$0: {\n"
        + "  $1: {\n"
        + "    2;\n"
        + "    3;\n"
View Full Code Here


  public final void testRenderPostReplace() {
    doReplace();
    StringBuilder sb = new StringBuilder();
    TokenConsumer tc = new JsPrettyPrinter(sb);
    root.render(new RenderContext(tc));
    tc.noMoreTokens();
    assertEquals(
        "$0: {\n"
        + "  $1: {\n"
        + "    2;\n"
        + "    3;\n"
View Full Code Here

  public final void testRenderPostInsert() {
    doInsert(5);
    StringBuilder sb = new StringBuilder();
    TokenConsumer tc = new JsPrettyPrinter(sb);
    root.render(new RenderContext(tc));
    tc.noMoreTokens();
    assertEquals(
        "$0: {\n"
        + "  $1: {\n"
        + "    2;\n"
        + "    3;\n"
View Full Code Here

  public final void testRenderPostInsert2() {
    doInsert(1);
    StringBuilder sb = new StringBuilder();
    TokenConsumer tc = new JsPrettyPrinter(sb);
    root.render(new RenderContext(tc));
    tc.noMoreTokens();
    assertEquals(
        "$0: {\n"
        + "  $9: {\n"
        + "    10;\n"
        + "    11;\n"
View Full Code Here

  public final void testRenderPostInsert3() {
    doInsert(-1);
    StringBuilder sb = new StringBuilder();
    TokenConsumer tc = new JsPrettyPrinter(sb);
    root.render(new RenderContext(tc));
    tc.noMoreTokens();
    assertEquals(
        "$0: {\n"
        + "  $1: {\n"
        + "    2;\n"
        + "    3;\n"
View Full Code Here

  public final void testRenderPostRemove() {
    doRemove(5);
    StringBuilder sb = new StringBuilder();
    TokenConsumer tc = new JsPrettyPrinter(sb);
    root.render(new RenderContext(tc));
    tc.noMoreTokens();
    assertEquals(
        "$0: {\n"
        + "  $1: {\n"
        + "    2;\n"
        + "    3;\n"
View Full Code Here

  public final void testRenderPostRemove2() {
    doRemove(1);
    StringBuilder sb = new StringBuilder();
    TokenConsumer tc = new JsPrettyPrinter(sb);
    root.render(new RenderContext(tc));
    tc.noMoreTokens();
    assertEquals(
        "$0: {\n"
        + "  $5: {\n"
        + "    6;\n"
        + "    7;\n"
View Full Code Here

      throws Exception {
    StringBuilder sb = new StringBuilder();
    TokenConsumer tc = new JsPrettyPrinter(sb);
    RenderContext rc = new RenderContext(tc);
    js(fromString(code)).children().get(0).render(rc);
    tc.noMoreTokens();
    assertEquals(code, expectedRendering, sb.toString());
  }

  private void assertMinified(String code, String expectedRendering)
      throws Exception {
View Full Code Here

    StringBuilder sb = new StringBuilder();
    TokenConsumer tc = new JsPrettyPrinter(sb);
    RenderContext rc = new RenderContext(tc);
    parseTree.render(rc);
    tc.noMoreTokens();
    sb.append('\n');

    String golden = TestUtil.readResource(getClass(), goldenFile);
    String actual = sb.toString();
    assertEquals(actual, golden, actual);
View Full Code Here

  public static String render(ParseTreeNode n) {
    StringBuilder output = new StringBuilder();
    TokenConsumer renderer = new JsPrettyPrinter(output);
    n.render(new RenderContext(renderer));
    renderer.noMoreTokens();
    return output.toString();
  }

  /**
   * Expands a parse tree node according to the rules of this
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.