Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: tests/compiler/dart2js/bad_output_io_test.dart

Issue 2690063002: Refactor CompilerOutput (Closed)
Patch Set: Cleanup. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Test that the compiler can handle imports when package root has not been set. 5 // Test that the compiler can handle imports when package root has not been set.
6 6
7 library dart2js.test.bad_output_io; 7 library dart2js.test.bad_output_io;
8 8
9 import 'dart:async';
9 import 'dart:io' show exit; 10 import 'dart:io' show exit;
10 import 'package:expect/expect.dart'; 11 import 'package:expect/expect.dart';
11 12
12 import 'package:compiler/compiler.dart' show Diagnostic; 13 import 'package:compiler/compiler.dart' show Diagnostic;
14 import 'package:compiler/compiler_new.dart' show OutputType;
13 import 'package:compiler/src/dart2js.dart' 15 import 'package:compiler/src/dart2js.dart'
14 show exitFunc, compileFunc, compile, diagnosticHandler; 16 show exitFunc, compileFunc, compile, diagnosticHandler;
15 import 'package:compiler/src/source_file_provider.dart' 17 import 'package:compiler/src/source_file_provider.dart'
16 show FormattingDiagnosticHandler; 18 show FormattingDiagnosticHandler;
17 19
18 class CollectingFormattingDiagnosticHandler 20 class CollectingFormattingDiagnosticHandler
19 implements FormattingDiagnosticHandler { 21 implements FormattingDiagnosticHandler {
20 final provider = null; 22 final provider = null;
21 bool showWarnings = true; 23 bool showWarnings = true;
22 bool showHints = true; 24 bool showHints = true;
(...skipping 26 matching lines...) Expand all
49 return message; 51 return message;
50 } 52 }
51 53
52 int fatalCount; 54 int fatalCount;
53 55
54 int throwOnErrorCount; 56 int throwOnErrorCount;
55 } 57 }
56 58
57 testOutputProvider(options, input, diagnostics, output) { 59 testOutputProvider(options, input, diagnostics, output) {
58 diagnosticHandler = new CollectingFormattingDiagnosticHandler(); 60 diagnosticHandler = new CollectingFormattingDiagnosticHandler();
59 output.createEventSink("/non/existing/directory/should/fail/file", "js"); 61 output.createOutputSink(
62 "/non/existing/directory/should/fail/file", "js", OutputType.js);
60 } 63 }
61 64
62 void main() { 65 void main() {
63 compileFunc = testOutputProvider; 66 compileFunc = testOutputProvider;
64 exitFunc = (exitCode) { 67 exitFunc = (exitCode) {
65 CollectingFormattingDiagnosticHandler handler = diagnosticHandler; 68 CollectingFormattingDiagnosticHandler handler = diagnosticHandler;
66 Expect.equals(1, handler.messages.length); 69 Expect.equals(1, handler.messages.length);
67 var message = handler.messages[0]; 70 var message = handler.messages[0];
68 Expect.isTrue(message[0].contains("Cannot open file")); 71 Expect.isTrue(message[0].contains("Cannot open file"));
69 Expect.equals(Diagnostic.ERROR, message[1]); 72 Expect.equals(Diagnostic.ERROR, message[1]);
70 Expect.equals(1, exitCode); 73 Expect.equals(1, exitCode);
71 exit(0); 74 exit(0);
72 }; 75 };
73 compile(["foo.dart", "--out=bar.dart"]); 76 compile(["foo.dart", "--out=bar.dart"]);
74 } 77 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698