| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 // Test that the compiler can handle missing files used in imports, exports, |
| 6 // part tags or as the main source file. |
| 7 |
| 8 library dart2js.test.import; |
| 9 |
| 10 import 'package:expect/expect.dart'; |
| 11 import 'memory_compiler.dart'; |
| 12 |
| 13 const MEMORY_SOURCE_FILES = const { |
| 14 'main.dart': ''' |
| 15 |
| 16 library main; |
| 17 |
| 18 import 'dart:thisLibraryShouldNotExist'; |
| 19 import 'package:thisPackageShouldNotExist/thisPackageShouldNotExist.dart'; |
| 20 export 'foo.dart'; |
| 21 |
| 22 part 'bar.dart'; |
| 23 |
| 24 main() { |
| 25 int i = ""; |
| 26 } |
| 27 ''', |
| 28 }; |
| 29 |
| 30 testMissingImports() { |
| 31 var collector = new DiagnosticCollector(); |
| 32 var compiler = compilerFor(MEMORY_SOURCE_FILES, diagnosticHandler: collector); |
| 33 compiler.run(Uri.parse('memory:main.dart')); |
| 34 Expect.equals(4, collector.errors.length); |
| 35 Expect.equals(1, collector.warnings.length); |
| 36 } |
| 37 |
| 38 testMissingMain() { |
| 39 var collector = new DiagnosticCollector(); |
| 40 var compiler = compilerFor({}, diagnosticHandler: collector); |
| 41 compiler.run(Uri.parse('memory:missing.dart')); |
| 42 Expect.equals(1, collector.errors.length); |
| 43 Expect.equals(0, collector.warnings.length); |
| 44 } |
| 45 |
| 46 void main() { |
| 47 testMissingImports(); |
| 48 testMissingMain(); |
| 49 } |
| OLD | NEW |