| Index: tests/compiler/dart2js/import_test.dart
|
| diff --git a/tests/compiler/dart2js/import_test.dart b/tests/compiler/dart2js/import_test.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..54748c43ff7d0c78c8f5f1f863977f00b8e81164
|
| --- /dev/null
|
| +++ b/tests/compiler/dart2js/import_test.dart
|
| @@ -0,0 +1,49 @@
|
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
|
| +// for details. All rights reserved. Use of this source code is governed by a
|
| +// BSD-style license that can be found in the LICENSE file.
|
| +
|
| +// Test that the compiler can handle missing files used in imports, exports,
|
| +// part tags or as the main source file.
|
| +
|
| +library dart2js.test.import;
|
| +
|
| +import 'package:expect/expect.dart';
|
| +import 'memory_compiler.dart';
|
| +
|
| +const MEMORY_SOURCE_FILES = const {
|
| + 'main.dart': '''
|
| +
|
| +library main;
|
| +
|
| +import 'dart:thisLibraryShouldNotExist';
|
| +import 'package:thisPackageShouldNotExist/thisPackageShouldNotExist.dart';
|
| +export 'foo.dart';
|
| +
|
| +part 'bar.dart';
|
| +
|
| +main() {
|
| + int i = "";
|
| +}
|
| +''',
|
| +};
|
| +
|
| +testMissingImports() {
|
| + var collector = new DiagnosticCollector();
|
| + var compiler = compilerFor(MEMORY_SOURCE_FILES, diagnosticHandler: collector);
|
| + compiler.run(Uri.parse('memory:main.dart'));
|
| + Expect.equals(4, collector.errors.length);
|
| + Expect.equals(1, collector.warnings.length);
|
| +}
|
| +
|
| +testMissingMain() {
|
| + var collector = new DiagnosticCollector();
|
| + var compiler = compilerFor({}, diagnosticHandler: collector);
|
| + compiler.run(Uri.parse('memory:missing.dart'));
|
| + Expect.equals(1, collector.errors.length);
|
| + Expect.equals(0, collector.warnings.length);
|
| +}
|
| +
|
| +void main() {
|
| + testMissingImports();
|
| + testMissingMain();
|
| +}
|
|
|