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

Unified Diff: tests/language/inheritance_chain_test.dart

Issue 1347423003: dart2js: Make sure that super classes have their inheritance chain set up correctly. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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/language/inheritance_chain_lib.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/inheritance_chain_test.dart
diff --git a/tests/language/inheritance_chain_test.dart b/tests/language/inheritance_chain_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..ef601523bfc644a2c6701650a7a868dc12766ff0
--- /dev/null
+++ b/tests/language/inheritance_chain_test.dart
@@ -0,0 +1,103 @@
+// 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 "inheritance_chain_lib.dart";
+
+class A extends B {
+ get id => "A";
+ get length => 1;
+}
+
+class C extends D {
+ get id => "C";
+ get length => 3;
+}
+
+class X extends W {
+ get id => "X";
+ get length => -3;
+}
+
+class Z extends Y {
+ get id => "Z";
+ get length => -1;
+}
+
+main() {
+ var instances = [
+ new A(),
+ new B(),
+ new C(),
+ new D(),
+ new W(),
+ new X(),
+ new Y(),
+ new Z(),
+ [],
+ ];
+
+ var o = instances[0];
+ Expect.equals("A", o.id);
+ Expect.equals(1, o.length);
+ Expect.isTrue(o is A);
+ Expect.isTrue(o is B);
+ Expect.isTrue(o is C);
+ Expect.isTrue(o is D);
+ Expect.isTrue(o is W);
+ Expect.isTrue(o is X);
+ Expect.isTrue(o is Y);
+ Expect.isTrue(o is Z);
+ o = instances[1];
+ Expect.equals("B", o.id);
+ Expect.equals(2, o.length);
+ Expect.isTrue(o is B);
+ Expect.isTrue(o is C);
+ Expect.isTrue(o is D);
+ Expect.isTrue(o is W);
+ Expect.isTrue(o is X);
+ Expect.isTrue(o is Y);
+ Expect.isTrue(o is Z);
+ o = instances[2];
+ Expect.equals("C", o.id);
+ Expect.equals(3, o.length);
+ Expect.isTrue(o is C);
+ Expect.isTrue(o is D);
+ Expect.isTrue(o is W);
+ Expect.isTrue(o is X);
+ Expect.isTrue(o is Y);
+ Expect.isTrue(o is Z);
+ o = instances[3];
+ Expect.equals("D", o.id);
+ Expect.equals(4, o.length);
+ Expect.isTrue(o is D);
+ Expect.isTrue(o is W);
+ Expect.isTrue(o is X);
+ Expect.isTrue(o is Y);
+ Expect.isTrue(o is Z);
+ o = instances[4];
+ Expect.equals("W", o.id);
+ Expect.equals(-4, o.length);
+ Expect.isTrue(o is W);
+ o = instances[5];
+ Expect.equals("X", o.id);
+ Expect.equals(-3, o.length);
+ Expect.isTrue(o is X);
+ Expect.isTrue(o is W);
+ o = instances[6];
+ Expect.equals("Y", o.id);
+ Expect.equals(-2, o.length);
+ Expect.isTrue(o is Y);
+ Expect.isTrue(o is X);
+ Expect.isTrue(o is W);
+ o = instances[7];
+ Expect.equals("Z", o.id);
+ Expect.equals(-1, o.length);
+ Expect.isTrue(o is Z);
+ Expect.isTrue(o is Y);
+ Expect.isTrue(o is X);
+ Expect.isTrue(o is W);
+ o = instances[8];
+ Expect.equals(0, o.length);
+}
« no previous file with comments | « tests/language/inheritance_chain_lib.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698