/** * Verifies that the compiler pass's JS output matches the expected output and (optionally) that * an expected warning is issued. Or, if an error is expected, this method just verifies that the * error is encountered. * * @param externs Externs inputs * @param js Inputs * @param expected Expected output, or null if an error is expected * @param error Expected error, or null if no error is expected * @param warning Expected warning, or null if no warning is expected * @param description The description of the expected warning, or null if no warning is expected * or if the warning's description should not be examined */ private void test( List<SourceFile> externs, List<SourceFile> js, String expected, DiagnosticType error, DiagnosticType warning, String description) { Compiler compiler = createCompiler(); lastCompiler = compiler; CompilerOptions options = getOptions(); options.setLanguageIn(acceptedLanguage); // Note that in this context, turning on the checkTypes option won't // actually cause the type check to run. options.checkTypes = parseTypeInfo; compiler.init(externs, js, options); BaseJSTypeTestCase.addNativeProperties(compiler.getTypeRegistry()); test(compiler, maybeCreateArray(expected), error, warning, description); }
@Override protected void setUp() throws Exception { super.setUp(); mode = LanguageMode.ECMASCRIPT3; isIdeMode = false; }