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

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

Issue 1395863002: Introduce the "Embedded" category. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fix analyzer test Created 5 years, 2 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/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);
+ });
+}
« no previous file with comments | « tests/compiler/dart2js/analyze_helper.dart ('k') | tests/compiler/dart2js/embedded_category_api_boundary_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698