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

Unified Diff: tests/language/config_import_corelib_test.dart

Issue 2579253003: Add one more test for configurable imports. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « tests/language/config_import_corelib_io.dart ('k') | tests/language/language.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/config_import_corelib_test.dart
diff --git a/tests/language/config_import_corelib_test.dart b/tests/language/config_import_corelib_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..6536426045b3afdac363b0e58c839b460a50ea9c
--- /dev/null
+++ b/tests/language/config_import_corelib_test.dart
@@ -0,0 +1,53 @@
+// 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 'config_import_corelib_general.dart'
+ if (dart.library.io) 'config_import_corelib_io.dart'
+ if (dart.library.http) 'config_import_corelib_http.dart'
+ as lib;
+
+class SubClassy extends lib.Classy {
+ String get superName => super.name;
+}
+
+main() {
+ var io = const bool.fromEnvironment("dart.library.io");
+ var http = const bool.fromEnvironment("dart.library.http");
+
+ var cy = new SubClassy();
+
+ if (io) {
+ Expect.isTrue(lib.general());
+ Expect.equals("io", lib.name);
+ Expect.equals("classy io", cy.name);
+
+ Expect.isTrue(lib.ioSpecific());
+ Expect.equals("classy io", cy.ioSpecific());
+
+ Expect.throws(() { lib.httpSpecific(); });
+ Expect.throws(() { cy.httpSpecific(); });
+ } else if (http) {
+ Expect.isTrue(lib.general());
+ Expect.equals("http", lib.name);
+ Expect.equals("classy http", cy.name);
+
+ Expect.throws(() { lib.ioSpecific(); });
+ Expect.throws(() { cy.ioSpecific(); });
+
+ Expect.isTrue(lib.httpSpecific());
+ Expect.equals("classy http", cy.httpSpecific());
+ } else {
+ Expect.isTrue(lib.general());
+ Expect.equals("general", lib.name);
+ Expect.equals("classy general", cy.name);
+
+ Expect.throws(() { lib.ioSpecific(); });
+ Expect.throws(() { cy.ioSpecific(); });
+
+ Expect.throws(() { lib.httpSpecific(); });
+ Expect.throws(() { cy.httpSpecific(); });
+ }
+}
« no previous file with comments | « tests/language/config_import_corelib_io.dart ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698