Index: tests/compiler/dart2js/categories_test.dart |
diff --git a/tests/compiler/dart2js/categories_test.dart b/tests/compiler/dart2js/categories_test.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3b22453112ca073a27266c86ad772165cf6b10ed |
--- /dev/null |
+++ b/tests/compiler/dart2js/categories_test.dart |
@@ -0,0 +1,35 @@ |
+// Copyright (c) 2015, 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. |
+ |
+import "package:expect/expect.dart"; |
+import 'package:async_helper/async_helper.dart'; |
+ |
+import "memory_compiler.dart"; |
+ |
+runTest(String source, String categories, int expectedErrors) async { |
+ var collector = new DiagnosticCollector(); |
+ await runCompiler( |
+ memorySourceFiles: {"main.dart": source}, |
+ options: ["--categories=$categories"], |
+ diagnosticHandler: collector); |
+ Expect.equals(expectedErrors, collector.errors.length); |
+ Expect.equals(0, collector.warnings.length); |
+} |
+ |
+void main() { |
+ asyncTest(() async { |
+ await runTest("import 'dart:async'; main() {}", "Embedded", 1); |
+ await runTest("import 'dart:async'; main() {}", "Client", 0); |
+ await runTest("import 'dart:async'; main() {}", "Server", 0); |
+ await runTest("import 'dart:html'; main() {}", "Embedded", 1); |
+ await runTest("import 'dart:html'; main() {}", "Client", 0); |
+ await runTest("import 'dart:html'; main() {}", "Server", 1); |
+ await runTest("import 'dart:io'; main() {}", "Embedded", 1); |
+ await runTest("import 'dart:io'; main() {}", "Client", 1); |
+ await runTest("import 'dart:io'; main() {}", "Server", 0); |
+ await runTest("import 'dart:_internal'; main() {}", "Embedded", 2); |
+ await runTest("import 'dart:_internal'; main() {}", "Client", 2); |
+ await runTest("import 'dart:_internal'; main() {}", "Server", 2); |
+ }); |
+} |