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

Unified Diff: tests/language/deferred_redirecting_factory_test.dart

Issue 1127363003: Insert the right checks for redirecting factories to deferred constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: update to status-file rebase Created 5 years, 7 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
« no previous file with comments | « tests/language/deferred_redirecting_factory_lib2.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/deferred_redirecting_factory_test.dart
diff --git a/tests/language/deferred_redirecting_factory_test.dart b/tests/language/deferred_redirecting_factory_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..847b2129bc5580fe67a87dc1d43ce7cab1b7876c
--- /dev/null
+++ b/tests/language/deferred_redirecting_factory_test.dart
@@ -0,0 +1,51 @@
+// 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.
+library main;
+
+import "deferred_redirecting_factory_lib1.dart" deferred as lib1;
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+
+class C {
+ String get foo => "main";
+ C();
+ factory C.a() = lib1.C;
+ factory C.b() = lib1.C.a;
+}
+
+test1() async {
+ Expect.throws(() {
+ new C.a();
+ });
+ Expect.throws(() {
+ new C.b();
+ });
+}
+
+test2() async {
+ await lib1.loadLibrary();
+ Expect.equals("lib1", new C.a().foo);
+ Expect.throws(() {
+ new C.b();
+ });
+}
+
+test3() async {
+ await lib1.loadLibrary();
+ await lib1.loadLib2();
+ Expect.equals("lib1", new C.a().foo);
+ Expect.equals("lib2", new C.b().foo);
+}
+
+
+test() async {
+ await test1(); /// 01: ok
+ await test2(); /// 02: ok
+ await test3(); /// 03: ok
+}
+
+void main() {
+ asyncStart();
+ test().then((_) => asyncEnd());
+}
« no previous file with comments | « tests/language/deferred_redirecting_factory_lib2.dart ('k') | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698