Package com.google.javascript.rhino

Examples of com.google.javascript.rhino.Node


  private Node newNode(int type, Node child1) {
    return new Node(type, child1).clonePropsFrom(templateNode);
  }

  private Node newNode(int type, Node child1, Node child2) {
    return new Node(type, child1, child2).clonePropsFrom(templateNode);
  }
View Full Code Here


  private Node newNode(int type, Node child1, Node child2) {
    return new Node(type, child1, child2).clonePropsFrom(templateNode);
  }

  private Node newNode(int type, Node child1, Node child2, Node child3) {
    return new Node(type, child1, child2, child3).clonePropsFrom(templateNode);
  }
View Full Code Here

      String... expectedWarnings) {
    TypeTransformationParser ttlParser = new TypeTransformationParser(ttlExp,
        SourceFile.fromCode("[testcode]", ttlExp), errorReporter, 0, 0);
    // Run the test if the parsing was successful
    if (ttlParser.parseTypeTransformation()) {
      Node ast = ttlParser.getTypeTransformationAst();
      // Create the scope using the extra definitions
      Node extraTypeDefs = compiler.parseTestCode(EXTRA_TYPE_DEFS);
      Scope scope = new TypedScopeCreator(compiler).createScope(
          extraTypeDefs, null);
      // Evaluate the type transformation
      TypeTransformation typeTransformation =
          new TypeTransformation(compiler, scope);
View Full Code Here

  public void testGenerateArray() {
    ArrayFuzzer fuzzer =
        new ArrayFuzzer(context);
    int budget = 10;
    Node node = fuzzer.generate(budget);
    String code = ArrayFuzzer.getPrettyCode(node);
    assertTrue(code.startsWith("["));
    assertTrue(code.endsWith("]"));
    JsonObject config = fuzzer.getOwnConfig();
    assertTrue(
View Full Code Here

                * (budget - 1)));
  }

  public void testGenerateNull() {
    SimpleFuzzer fuzzer = new SimpleFuzzer(Token.NULL, "null", Type.OBJECT);
    Node node = fuzzer.generate(30);
    assertEquals("null", SimpleFuzzer.getPrettyCode(node));
  }
View Full Code Here

    assertEquals("null", SimpleFuzzer.getPrettyCode(node));
  }

  public void testGenerateBoolean() {
    BooleanFuzzer fuzzer = new BooleanFuzzer(context);
    Node node = fuzzer.generate(10);
    String code = BooleanFuzzer.getPrettyCode(node).trim();
    assertTrue(
        "\nGenerated code: \n" + code,
        code.equals("true") || code.equals("false"));
  }
View Full Code Here

        "\nGenerated code: \n" + code,
        code.equals("true") || code.equals("false"));
  }
  public void testGenerateNumeric() {
    NumericFuzzer fuzzer = new NumericFuzzer(context);
    Node node = fuzzer.generate(10);
    String code = NumericFuzzer.getPrettyCode(node);
    for (int i = 0; i < code.length(); i++) {
      assertTrue("\nGenerated code: \n" + code, code.charAt(i) >= '0');
      assertTrue("\nGenerated code: \n" + code, code.charAt(i) <= '9');
    }
View Full Code Here

    }
  }

  public void testGenerateString() {
    StringFuzzer fuzzer = new StringFuzzer(context);
    Node node = fuzzer.generate(10);
    String code = StringFuzzer.getPrettyCode(node);
    assertTrue("\nGenerated code: \n" + code, code.startsWith("\""));
    assertTrue("\nGenerated code: \n" + code, code.endsWith("\""));
  }
View Full Code Here

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

  public void testGenerateRegex() {
    RegularExprFuzzer fuzzer = new RegularExprFuzzer(context);
    Node node = fuzzer.generate(10);
    String code = RegularExprFuzzer.getPrettyCode(node);
    assertTrue("\nGenerated code: \n" + code, code.startsWith("/"));
    assertNotSame('/', code.charAt(1));
  }
View Full Code Here

    assertNotSame('/', code.charAt(1));
  }

  public void testGenerateObjectLiteral() {
    ObjectFuzzer fuzzer = new ObjectFuzzer(context);
    Node node = fuzzer.generate(10);
    String code = ObjectFuzzer.getPrettyCode(node);
    assertTrue("\nGenerated code: \n" + code, code.startsWith("{"));
    assertTrue("\nGenerated code: \n" + code, code.endsWith("}"));
  }
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.