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

Unified Diff: tests/lib/mirrors/circular_factory_redirection_test.dart

Issue 25097005: Make ClassMirror.newInstance deal with reordered etc type arguments for redirecting factories. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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/lib/lib.status ('k') | tests/lib/mirrors/redirecting_factory_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/lib/mirrors/circular_factory_redirection_test.dart
diff --git a/tests/lib/mirrors/circular_factory_redirection_test.dart b/tests/lib/mirrors/circular_factory_redirection_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..a7b188217a829d379853406188e3f6cbd7e7581f
--- /dev/null
+++ b/tests/lib/mirrors/circular_factory_redirection_test.dart
@@ -0,0 +1,37 @@
+// 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.
+
+import "dart:mirrors";
+import "package:expect/expect.dart";
+
+class A {
+ A();
+ A.circular() = B.circular; /// 01: compile-time error
+ const A.circular2() = B.circular2; /// 02: compile-time error
+}
+class B {
+ B();
+ B.circular() = C.circular; /// 01: continued
+ const B.circular2() = C.circular2; /// 02: continued
+}
+class C {
+ C();
+ C.circular() = A.circular; /// 01: continued
+ const C.circular2() = A.circular2; /// 02: continued
+}
+
+main() {
+ ClassMirror cm = reflectClass(A);
+
+ new A.circular(); /// 01: continued
+ new A.circular2(); /// 02: continued
+
+ Expect.throws(() => cm.newInstance(#circular, []),
+ (e) => e is NoSuchMethodError,
+ 'Should disallow circular redirection (non-const)');
+
+ Expect.throws(() => cm.newInstance(#circular2, []),
+ (e) => e is NoSuchMethodError,
+ 'Should disallow circular redirection (const)');
+}
« no previous file with comments | « tests/lib/lib.status ('k') | tests/lib/mirrors/redirecting_factory_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698