test/com/google/javascript/jscomp/IntegrationTestCase.java
/**
   * Asserts that there is at least one parse error.
   */
Asserts that there is at least one parse error.
Asserts that there is at least one parse error .
protected void testParseError(CompilerOptions options,
      String original, String compiled) {
    Compiler compiler = compile(options, original);
    for (JSError error : compiler.getErrors()) {
      if (!error.getType().equals(RhinoErrorReporter.PARSE_ERROR)) {
        assertWithMessage("Found unexpected error type " + error.getType() + ":\n" + error).fail();
      }
    }
    assertWithMessage("Unexpected warnings: " + Joiner.on("\n").join(compiler.getWarnings()))
        .that(compiler.getWarnings().length)
        .isEqualTo(0);
    if (compiled != null) {
      Node root = compiler.getRoot().getLastChild();
      Node expectedRoot = parseExpectedCode(
          new String[] {compiled}, options, normalizeResults);
      String explanation = expectedRoot.checkTreeEquals(root);
      assertWithMessage(
              "\nExpected: "
                  + compiler.toSource(expectedRoot)
                  + "\nResult: "
                  + compiler.toSource(root)
                  + "\n"
                  + explanation)
          .that(explanation)
          .isNull();
    }
  }
protected void testParseError ( CompilerOptions options , String original , String compiled ) { Compiler compiler = compile ( options , original ) ; for ( JSError error : compiler . getErrors ( ) ) { if ( ! error . getType ( ) . equals ( RhinoErrorReporter . PARSE_ERROR ) ) { assertWithMessage ( "Found unexpected error type " + error . getType ( ) + ":\n" + error ) . fail ( ) ; } } assertWithMessage ( "Unexpected warnings: " + Joiner . on ( "\n" ) . join ( compiler . getWarnings ( ) ) ) . that ( compiler . getWarnings ( ) . length ) . isEqualTo ( 0 ) ; if ( compiled != null ) { Node root = compiler . getRoot ( ) . getLastChild ( ) ; Node expectedRoot = parseExpectedCode ( new String [ ] { compiled } , options , normalizeResults ) ; String explanation = expectedRoot . checkTreeEquals ( root ) ; assertWithMessage ( "\nExpected: " + compiler . toSource ( expectedRoot ) + "\nResult: " + compiler . toSource ( root ) + "\n" + explanation ) . that ( explanation ) . isNull ( ) ; } }
Asserts that there is at least one parse error.
Asserts that there is at least one parse error .