| OLD | NEW |
| 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:io' show exit; | 9 import 'dart:io' show exit; |
| 10 import 'package:expect/expect.dart'; | 10 import 'package:expect/expect.dart'; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 String prefixMessage(String message, Diagnostic kind) { | 50 String prefixMessage(String message, Diagnostic kind) { |
| 51 return message; | 51 return message; |
| 52 } | 52 } |
| 53 | 53 |
| 54 int fatalCount; | 54 int fatalCount; |
| 55 | 55 |
| 56 int throwOnErrorCount; | 56 int throwOnErrorCount; |
| 57 } | 57 } |
| 58 | 58 |
| 59 testOutputProvider(script, libraryRoot, packageRoot, inputProvider, handler, | 59 testOutputProvider(options, input, diagnostics, output) { |
| 60 [options, outputProvider, environment, packageConfig, | |
| 61 findPackages]) { | |
| 62 diagnosticHandler = new CollectingFormattingDiagnosticHandler(); | 60 diagnosticHandler = new CollectingFormattingDiagnosticHandler(); |
| 63 outputProvider("/non/existing/directory/should/fail/file", "js"); | 61 output.createEventSink("/non/existing/directory/should/fail/file", "js"); |
| 64 } | 62 } |
| 65 | 63 |
| 66 void main() { | 64 void main() { |
| 67 compileFunc = testOutputProvider; | 65 compileFunc = testOutputProvider; |
| 68 exitFunc = (exitCode) { | 66 exitFunc = (exitCode) { |
| 69 CollectingFormattingDiagnosticHandler handler = diagnosticHandler; | 67 CollectingFormattingDiagnosticHandler handler = diagnosticHandler; |
| 70 Expect.equals(1, handler.messages.length); | 68 Expect.equals(1, handler.messages.length); |
| 71 var message = handler.messages[0]; | 69 var message = handler.messages[0]; |
| 72 Expect.isTrue(message[0].contains("Cannot open file")); | 70 Expect.isTrue(message[0].contains("Cannot open file")); |
| 73 Expect.equals(Diagnostic.ERROR, message[1]); | 71 Expect.equals(Diagnostic.ERROR, message[1]); |
| 74 Expect.equals(1, exitCode); | 72 Expect.equals(1, exitCode); |
| 75 exit(0); | 73 exit(0); |
| 76 }; | 74 }; |
| 77 compile(["foo.dart", "--out=bar.dart"]); | 75 compile(["foo.dart", "--out=bar.dart"]); |
| 78 } | 76 } |
| OLD | NEW |