Java 类org.mozilla.javascript.testing.TestErrorReporter 实例源码

项目:whackpad    文件:ParserTest.java   
private AstRoot parse(String string, boolean jsdoc) {
    CompilerEnvirons environment = new CompilerEnvirons();

    TestErrorReporter testErrorReporter = new TestErrorReporter(null, null);
    environment.setErrorReporter(testErrorReporter);

    environment.setRecordingComments(true);
    environment.setRecordingLocalJsDocComments(jsdoc);

    Parser p = new Parser(environment, testErrorReporter);
    AstRoot script = p.parse(string, null, 0);

    assertTrue(testErrorReporter.hasEncounteredAllErrors());
    assertTrue(testErrorReporter.hasEncounteredAllWarnings());

    return script;
}
项目:whackpad    文件:ParserTest.java   
private AstRoot parseAsReader(String string) throws IOException {
    CompilerEnvirons environment = new CompilerEnvirons();

    TestErrorReporter testErrorReporter = new TestErrorReporter(null, null);
    environment.setErrorReporter(testErrorReporter);

    environment.setRecordingComments(true);
    environment.setRecordingLocalJsDocComments(true);

    Parser p = new Parser(environment, testErrorReporter);
    AstRoot script = p.parse(new StringReader(string), null, 0);

    assertTrue(testErrorReporter.hasEncounteredAllErrors());
    assertTrue(testErrorReporter.hasEncounteredAllWarnings());

    return script;
}
项目:rhino-android    文件:ParserTest.java   
private AstRoot parse(
    String string, final String [] errors, final String [] warnings,
    boolean jsdoc) {
    TestErrorReporter testErrorReporter =
        new TestErrorReporter(errors, warnings) {
      @Override
      public EvaluatorException runtimeError(
           String message, String sourceName, int line, String lineSource,
           int lineOffset) {
         if (errors == null) {
           throw new UnsupportedOperationException();
         }
         return new EvaluatorException(
           message, sourceName, line, lineSource, lineOffset);
       }
    };
    environment.setErrorReporter(testErrorReporter);

    environment.setRecordingComments(true);
    environment.setRecordingLocalJsDocComments(jsdoc);

    Parser p = new Parser(environment, testErrorReporter);
    AstRoot script = null;
    try {
      script = p.parse(string, null, 0);
    } catch (EvaluatorException e) {
      if (errors == null) {
        // EvaluationExceptions should not occur when we aren't expecting
        // errors.
        throw e;
      }
    }

    assertTrue(testErrorReporter.hasEncounteredAllErrors());
    assertTrue(testErrorReporter.hasEncounteredAllWarnings());

    return script;
}
项目:rhino-android    文件:ParserTest.java   
private AstRoot parseAsReader(String string) throws IOException {
    TestErrorReporter testErrorReporter = new TestErrorReporter(null, null);
    environment.setErrorReporter(testErrorReporter);

    environment.setRecordingComments(true);
    environment.setRecordingLocalJsDocComments(true);

    Parser p = new Parser(environment, testErrorReporter);
    AstRoot script = p.parse(new StringReader(string), null, 0);

    assertTrue(testErrorReporter.hasEncounteredAllErrors());
    assertTrue(testErrorReporter.hasEncounteredAllWarnings());

    return script;
}
项目:code404    文件:ParserTest.java   
private AstRoot parse(
    String string, final String [] errors, final String [] warnings,
    boolean jsdoc) {
    TestErrorReporter testErrorReporter =
        new TestErrorReporter(errors, warnings) {
      @Override
      public EvaluatorException runtimeError(
           String message, String sourceName, int line, String lineSource,
           int lineOffset) {
         if (errors == null) {
           throw new UnsupportedOperationException();
         }
         return new EvaluatorException(
           message, sourceName, line, lineSource, lineOffset);
       }
    };
    environment.setErrorReporter(testErrorReporter);

    environment.setRecordingComments(true);
    environment.setRecordingLocalJsDocComments(jsdoc);

    Parser p = new Parser(environment, testErrorReporter);
    AstRoot script = null;
    try {
      script = p.parse(string, null, 0);
    } catch (EvaluatorException e) {
      if (errors == null) {
        // EvaluationExceptions should not occur when we aren't expecting
        // errors.
        throw e;
      }
    }

    assertTrue(testErrorReporter.hasEncounteredAllErrors());
    assertTrue(testErrorReporter.hasEncounteredAllWarnings());

    return script;
}
项目:code404    文件:ParserTest.java   
private AstRoot parseAsReader(String string) throws IOException {
    TestErrorReporter testErrorReporter = new TestErrorReporter(null, null);
    environment.setErrorReporter(testErrorReporter);

    environment.setRecordingComments(true);
    environment.setRecordingLocalJsDocComments(true);

    Parser p = new Parser(environment, testErrorReporter);
    AstRoot script = p.parse(new StringReader(string), null, 0);

    assertTrue(testErrorReporter.hasEncounteredAllErrors());
    assertTrue(testErrorReporter.hasEncounteredAllWarnings());

    return script;
}
项目:rhino-jscover    文件:ParserTest.java   
private AstRoot parse(
    String string, final String [] errors, final String [] warnings,
    boolean jsdoc) {
    TestErrorReporter testErrorReporter =
        new TestErrorReporter(errors, warnings) {
      @Override
      public EvaluatorException runtimeError(
           String message, String sourceName, int line, String lineSource,
           int lineOffset) {
         if (errors == null) {
           throw new UnsupportedOperationException();
         }
         return new EvaluatorException(
           message, sourceName, line, lineSource, lineOffset);
       }
    };
    environment.setErrorReporter(testErrorReporter);

    environment.setRecordingComments(true);
    environment.setRecordingLocalJsDocComments(jsdoc);

    Parser p = new Parser(environment, testErrorReporter);
    AstRoot script = null;
    try {
      script = p.parse(string, null, 0);
    } catch (EvaluatorException e) {
      if (errors == null) {
        // EvaluationExceptions should not occur when we aren't expecting
        // errors.
        throw e;
      }
    }

    assertTrue(testErrorReporter.hasEncounteredAllErrors());
    assertTrue(testErrorReporter.hasEncounteredAllWarnings());

    return script;
}
项目:rhino-jscover    文件:ParserTest.java   
private AstRoot parseAsReader(String string) throws IOException {
    TestErrorReporter testErrorReporter = new TestErrorReporter(null, null);
    environment.setErrorReporter(testErrorReporter);

    environment.setRecordingComments(true);
    environment.setRecordingLocalJsDocComments(true);

    Parser p = new Parser(environment, testErrorReporter);
    AstRoot script = p.parse(new StringReader(string), null, 0);

    assertTrue(testErrorReporter.hasEncounteredAllErrors());
    assertTrue(testErrorReporter.hasEncounteredAllWarnings());

    return script;
}
项目:astor    文件:ParserTest.java   
private AstRoot parse(
    String string, final String [] errors, final String [] warnings,
    boolean jsdoc) {
    TestErrorReporter testErrorReporter =
        new TestErrorReporter(errors, warnings) {
      @Override
      public EvaluatorException runtimeError(
           String message, String sourceName, int line, String lineSource,
           int lineOffset) {
         if (errors == null) {
           throw new UnsupportedOperationException();
         }
         return new EvaluatorException(
           message, sourceName, line, lineSource, lineOffset);
       }
    };
    environment.setErrorReporter(testErrorReporter);

    environment.setRecordingComments(true);
    environment.setRecordingLocalJsDocComments(jsdoc);

    Parser p = new Parser(environment, testErrorReporter);
    AstRoot script = null;
    try {
      script = p.parse(string, null, 0);
    } catch (EvaluatorException e) {
      if (errors == null) {
        // EvaluationExceptions should not occur when we aren't expecting
        // errors.
        throw e;
      }
    }

    assertTrue(testErrorReporter.hasEncounteredAllErrors());
    assertTrue(testErrorReporter.hasEncounteredAllWarnings());

    return script;
}
项目:astor    文件:ParserTest.java   
private AstRoot parseAsReader(String string) throws IOException {
    TestErrorReporter testErrorReporter = new TestErrorReporter(null, null);
    environment.setErrorReporter(testErrorReporter);

    environment.setRecordingComments(true);
    environment.setRecordingLocalJsDocComments(true);

    Parser p = new Parser(environment, testErrorReporter);
    AstRoot script = p.parse(new StringReader(string), null, 0);

    assertTrue(testErrorReporter.hasEncounteredAllErrors());
    assertTrue(testErrorReporter.hasEncounteredAllWarnings());

    return script;
}
项目:Rhino-Prov-Mod    文件:ParserTest.java   
private AstRoot parse(
    String string, final String [] errors, final String [] warnings,
    boolean jsdoc) {
    TestErrorReporter testErrorReporter =
        new TestErrorReporter(errors, warnings) {
      @Override
      public EvaluatorException runtimeError(
           String message, String sourceName, int line, String lineSource,
           int lineOffset) {
         if (errors == null) {
           throw new UnsupportedOperationException();
         }
         return new EvaluatorException(
           message, sourceName, line, lineSource, lineOffset);
       }
    };
    environment.setErrorReporter(testErrorReporter);

    environment.setRecordingComments(true);
    environment.setRecordingLocalJsDocComments(jsdoc);

    Parser p = new Parser(environment, testErrorReporter);
    AstRoot script = null;
    try {
      script = p.parse(string, null, 0);
    } catch (EvaluatorException e) {
      if (errors == null) {
        // EvaluationExceptions should not occur when we aren't expecting
        // errors.
        throw e;
      }
    }

    assertTrue(testErrorReporter.hasEncounteredAllErrors());
    assertTrue(testErrorReporter.hasEncounteredAllWarnings());

    return script;
}
项目:Rhino-Prov-Mod    文件:ParserTest.java   
private AstRoot parseAsReader(String string) throws IOException {
    TestErrorReporter testErrorReporter = new TestErrorReporter(null, null);
    environment.setErrorReporter(testErrorReporter);

    environment.setRecordingComments(true);
    environment.setRecordingLocalJsDocComments(true);

    Parser p = new Parser(environment, testErrorReporter);
    AstRoot script = p.parse(new StringReader(string), null, 0);

    assertTrue(testErrorReporter.hasEncounteredAllErrors());
    assertTrue(testErrorReporter.hasEncounteredAllWarnings());

    return script;
}