Package com.google.javascript.rhino

Examples of com.google.javascript.rhino.Node


  }

  public void testWhileStatement() {
    WhileFuzzer fuzzer =
        new WhileFuzzer(context);
    Node whileStatement = fuzzer.generate(10);
    String code = WhileFuzzer.getPrettyCode(whileStatement);
    assertTrue(code.startsWith("while ("));
  }
View Full Code Here


  }

  public void testDoWhileStatement() {
    DoWhileFuzzer fuzzer =
        new DoWhileFuzzer(context);
    Node doStatement = fuzzer.generate(10);
    String code = DoWhileFuzzer.getPrettyCode(doStatement);
    assertTrue(code.startsWith("do {"));
    assertTrue(code.trim().endsWith(");"));

  }
View Full Code Here

  }

  public void testForStatement() {
    ForFuzzer fuzzer = new ForFuzzer(context);
    Node forStatement = fuzzer.generate(10);
    String code = ForFuzzer.getPrettyCode(forStatement);
    assertTrue(code.startsWith("for ("));
  }
View Full Code Here

  }

  public void testForInStatement() {
    ForInFuzzer fuzzer =
        new ForInFuzzer(context);
    Node forInStatement = fuzzer.generate(10);
    String code = ForInFuzzer.getPrettyCode(forInStatement);
    assertTrue("\nGenerated code: \n" + code, code.startsWith("for ("));
    assertTrue("\nGenerated code: \n" + code, code.contains(" in "));
  }
View Full Code Here

  }

  public void testSwitchStatement() {
    SwitchFuzzer fuzzer =
        new SwitchFuzzer(context);
    Node switchStmt = fuzzer.generate(20);
    String code = SwitchFuzzer.getPrettyCode(switchStmt);
    assertTrue("\nGenerated code: \n" + code, code.startsWith("switch("));
  }
View Full Code Here

  }

  public void testThrowStatement() {
    ThrowFuzzer fuzzer =
        new ThrowFuzzer(context);
    Node throwStatement = fuzzer.generate(10);
    String code = ThrowFuzzer.getPrettyCode(throwStatement);
    assertTrue("\nGenerated code: \n" + code, code.startsWith("throw"));
  }
View Full Code Here

    assertTrue("\nGenerated code: \n" + code, code.startsWith("throw"));
  }

  public void testTryStatement() {
    TryFuzzer fuzzer = new TryFuzzer(context);
    Node tryStatement = fuzzer.generate(20);
    String code = TryFuzzer.getPrettyCode(tryStatement);
    assertTrue("\nGenerated code: \n" + code, code.startsWith("try {"));
  }
View Full Code Here

  }

  public void testFunctionDeclaration() {
    FunctionFuzzer fuzzer =
        new FunctionFuzzer(context, false);
    Node functionDecl = fuzzer.generate(20);
    String code = FunctionFuzzer.getPrettyCode(functionDecl);
    assertTrue("\nGenerated code: \n" + code, code.startsWith("function "));
  }
View Full Code Here

  public void testBreakStatement() throws JsonParseException {
    BreakFuzzer fuzzer = new BreakFuzzer(context);
    fuzzer.getOwnConfig().addProperty("toLabel", 1);
    Scope scope = context.scopeManager.localScope();
    scope.otherLabels.add("testLabel");
    Node breakStmt = fuzzer.generate(10);
    String code = BreakFuzzer.getPrettyCode(breakStmt);
    assertEquals("break testLabel;", code.trim());
  }
View Full Code Here

  public void testContinueStatement() throws JsonParseException {
    ContinueFuzzer fuzzer = new ContinueFuzzer(context);
    fuzzer.getOwnConfig().addProperty("toLabel", 1);
    Scope scope = context.scopeManager.localScope();
    scope.loopLabels.add("testLabel");
    Node continueStmt = fuzzer.generate(10);
    String code = ContinueFuzzer.getPrettyCode(continueStmt);
    assertEquals("continue testLabel;", code.trim());
  }
View Full Code Here

TOP

Related Classes of com.google.javascript.rhino.Node

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.