OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. |
| 4 |
| 5 import "package:expect/expect.dart"; |
| 6 import "inheritance_chain_lib.dart"; |
| 7 |
| 8 class A extends B { |
| 9 get id => "A"; |
| 10 get length => 1; |
| 11 } |
| 12 |
| 13 class C extends D { |
| 14 get id => "C"; |
| 15 get length => 3; |
| 16 } |
| 17 |
| 18 class X extends W { |
| 19 get id => "X"; |
| 20 get length => -3; |
| 21 } |
| 22 |
| 23 class Z extends Y { |
| 24 get id => "Z"; |
| 25 get length => -1; |
| 26 } |
| 27 |
| 28 main() { |
| 29 var instances = [ |
| 30 new A(), |
| 31 new B(), |
| 32 new C(), |
| 33 new D(), |
| 34 new W(), |
| 35 new X(), |
| 36 new Y(), |
| 37 new Z(), |
| 38 [], |
| 39 ]; |
| 40 |
| 41 var o = instances[0]; |
| 42 Expect.equals("A", o.id); |
| 43 Expect.equals(1, o.length); |
| 44 Expect.isTrue(o is A); |
| 45 Expect.isTrue(o is B); |
| 46 Expect.isTrue(o is C); |
| 47 Expect.isTrue(o is D); |
| 48 Expect.isTrue(o is W); |
| 49 Expect.isTrue(o is X); |
| 50 Expect.isTrue(o is Y); |
| 51 Expect.isTrue(o is Z); |
| 52 o = instances[1]; |
| 53 Expect.equals("B", o.id); |
| 54 Expect.equals(2, o.length); |
| 55 Expect.isTrue(o is B); |
| 56 Expect.isTrue(o is C); |
| 57 Expect.isTrue(o is D); |
| 58 Expect.isTrue(o is W); |
| 59 Expect.isTrue(o is X); |
| 60 Expect.isTrue(o is Y); |
| 61 Expect.isTrue(o is Z); |
| 62 o = instances[2]; |
| 63 Expect.equals("C", o.id); |
| 64 Expect.equals(3, o.length); |
| 65 Expect.isTrue(o is C); |
| 66 Expect.isTrue(o is D); |
| 67 Expect.isTrue(o is W); |
| 68 Expect.isTrue(o is X); |
| 69 Expect.isTrue(o is Y); |
| 70 Expect.isTrue(o is Z); |
| 71 o = instances[3]; |
| 72 Expect.equals("D", o.id); |
| 73 Expect.equals(4, o.length); |
| 74 Expect.isTrue(o is D); |
| 75 Expect.isTrue(o is W); |
| 76 Expect.isTrue(o is X); |
| 77 Expect.isTrue(o is Y); |
| 78 Expect.isTrue(o is Z); |
| 79 o = instances[4]; |
| 80 Expect.equals("W", o.id); |
| 81 Expect.equals(-4, o.length); |
| 82 Expect.isTrue(o is W); |
| 83 o = instances[5]; |
| 84 Expect.equals("X", o.id); |
| 85 Expect.equals(-3, o.length); |
| 86 Expect.isTrue(o is X); |
| 87 Expect.isTrue(o is W); |
| 88 o = instances[6]; |
| 89 Expect.equals("Y", o.id); |
| 90 Expect.equals(-2, o.length); |
| 91 Expect.isTrue(o is Y); |
| 92 Expect.isTrue(o is X); |
| 93 Expect.isTrue(o is W); |
| 94 o = instances[7]; |
| 95 Expect.equals("Z", o.id); |
| 96 Expect.equals(-1, o.length); |
| 97 Expect.isTrue(o is Z); |
| 98 Expect.isTrue(o is Y); |
| 99 Expect.isTrue(o is X); |
| 100 Expect.isTrue(o is W); |
| 101 o = instances[8]; |
| 102 Expect.equals(0, o.length); |
| 103 } |
OLD | NEW |