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

Unified Diff: tests/compiler/dart2js/import_test.dart

Issue 21544003: Handle missing imports/exports/parts. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
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..3b399b6aaa21d73a542cff47c165b1637d96bed2
--- /dev/null
+++ b/tests/compiler/dart2js/import_test.dart
@@ -0,0 +1,47 @@
+// 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 imports when package root has not been set.
+
+library dart2js.test.import;
+
+import 'package:expect/expect.dart';
+import 'memory_compiler.dart';
+
+const MEMORY_SOURCE_FILES = const {
+ 'main.dart': '''
+
+library main;
+
+import 'dart:bar';
ahe 2013/08/06 15:01:00 The comment on line 5 implies that you meant packa
Johnni Winther 2013/08/19 08:05:19 Done.
+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(3, 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();
+}

Powered by Google App Engine
This is Rietveld 408576698