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 missing files used in imports, exports, | 5 // Test that the compiler can handle missing files used in imports, exports, |
6 // part tags or as the main source file. | 6 // part tags or as the main source file. |
7 | 7 |
8 library dart2js.test.import; | 8 library dart2js.test.import; |
9 | 9 |
10 import 'package:expect/expect.dart'; | 10 import 'package:expect/expect.dart'; |
(...skipping 15 matching lines...) Expand all Loading... |
26 int i = ""; | 26 int i = ""; |
27 } | 27 } |
28 ''', | 28 ''', |
29 }; | 29 }; |
30 | 30 |
31 testMissingImports() { | 31 testMissingImports() { |
32 var collector = new DiagnosticCollector(); | 32 var collector = new DiagnosticCollector(); |
33 var compiler = compilerFor(MEMORY_SOURCE_FILES, diagnosticHandler: collector); | 33 var compiler = compilerFor(MEMORY_SOURCE_FILES, diagnosticHandler: collector); |
34 asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) { | 34 asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) { |
35 Expect.equals(4, collector.errors.length); | 35 Expect.equals(4, collector.errors.length); |
36 Expect.equals(1, collector.warnings.length); | 36 // TODO(johnniwinther): Expect 1 warning when analysis of programs with load |
| 37 // failures is reenabled. |
| 38 Expect.equals(0, collector.warnings.length); |
37 })); | 39 })); |
38 } | 40 } |
39 | 41 |
40 testMissingMain() { | 42 testMissingMain() { |
41 var collector = new DiagnosticCollector(); | 43 var collector = new DiagnosticCollector(); |
42 var compiler = compilerFor({}, diagnosticHandler: collector); | 44 var compiler = compilerFor({}, diagnosticHandler: collector); |
43 asyncTest(() => compiler.run(Uri.parse('memory:missing.dart')).then((_) { | 45 asyncTest(() => compiler.run(Uri.parse('memory:missing.dart')).then((_) { |
44 Expect.equals(1, collector.errors.length); | 46 Expect.equals(1, collector.errors.length); |
45 Expect.equals(0, collector.warnings.length); | 47 Expect.equals(0, collector.warnings.length); |
46 })); | 48 })); |
47 } | 49 } |
48 | 50 |
49 void main() { | 51 void main() { |
50 testMissingImports(); | 52 testMissingImports(); |
51 testMissingMain(); | 53 testMissingMain(); |
52 } | 54 } |
OLD | NEW |