OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 import 'package:expect/expect.dart'; | 5 import 'package:expect/expect.dart'; |
6 import 'dart:mirrors'; | 6 import 'dart:mirrors'; |
7 | 7 |
8 | 8 |
9 class A<T> {} | 9 class A<T> {} |
10 class B extends A<U>{} | 10 class B extends A<U>{} |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 Expect.isTrue(superA.isOriginalDeclaration); | 45 Expect.isTrue(superA.isOriginalDeclaration); |
46 Expect.isFalse(superB.isOriginalDeclaration); | 46 Expect.isFalse(superB.isOriginalDeclaration); |
47 Expect.isFalse(superC.isOriginalDeclaration); | 47 Expect.isFalse(superC.isOriginalDeclaration); |
48 Expect.isFalse(superD.isOriginalDeclaration); | 48 Expect.isFalse(superD.isOriginalDeclaration); |
49 Expect.isFalse(superE.isOriginalDeclaration); | 49 Expect.isFalse(superE.isOriginalDeclaration); |
50 Expect.isFalse(superInterfaceF.isOriginalDeclaration); | 50 Expect.isFalse(superInterfaceF.isOriginalDeclaration); |
51 Expect.isFalse(superInterfaceFF.isOriginalDeclaration); | 51 Expect.isFalse(superInterfaceFF.isOriginalDeclaration); |
52 | 52 |
53 Expect.equals(reflectClass(Object), superA); | 53 Expect.equals(reflectClass(Object), superA); |
54 Expect.equals(reflect(new A<U>()).type, superB); | 54 Expect.equals(reflect(new A<U>()).type, superB); |
55 Expect.equals(reflect(new A<C>()).type, superC); /// 01: ok | 55 Expect.equals(reflect(new A<C>()).type, superC); //# 01: ok |
56 Expect.equals(reflect(new U()).type, superB.typeArguments[0]); | 56 Expect.equals(reflect(new U()).type, superB.typeArguments[0]); |
57 Expect.equals(reflect(new C()).type, superC.typeArguments[0]); /// 01: ok | 57 Expect.equals(reflect(new C()).type, superC.typeArguments[0]); //# 01: ok |
58 Expect.equals(dT, superD.typeArguments[0]); | 58 Expect.equals(dT, superD.typeArguments[0]); |
59 Expect.equals(eY, superE.typeArguments[0].typeArguments[0]); | 59 Expect.equals(eY, superE.typeArguments[0].typeArguments[0]); |
60 Expect.equals(feY, superInterfaceFF.typeArguments[0].typeArguments[0]); | 60 Expect.equals(feY, superInterfaceFF.typeArguments[0].typeArguments[0]); |
61 Expect.equals(fX, superInterfaceF.typeArguments[0]); | 61 Expect.equals(fX, superInterfaceF.typeArguments[0]); |
62 } | 62 } |
63 | 63 |
64 void testInstances() { | 64 void testInstances() { |
65 ClassMirror a = reflect(new A<U>()).type; | 65 ClassMirror a = reflect(new A<U>()).type; |
66 ClassMirror b = reflect(new B()).type; | 66 ClassMirror b = reflect(new B()).type; |
67 ClassMirror c = reflect(new C()).type; | 67 ClassMirror c = reflect(new C()).type; |
(...skipping 19 matching lines...) Expand all Loading... |
87 Expect.isFalse(superB.isOriginalDeclaration); | 87 Expect.isFalse(superB.isOriginalDeclaration); |
88 Expect.isFalse(superC.isOriginalDeclaration); | 88 Expect.isFalse(superC.isOriginalDeclaration); |
89 Expect.isFalse(superD.isOriginalDeclaration); | 89 Expect.isFalse(superD.isOriginalDeclaration); |
90 Expect.isFalse(superE.isOriginalDeclaration); | 90 Expect.isFalse(superE.isOriginalDeclaration); |
91 Expect.isFalse(superE0.isOriginalDeclaration); | 91 Expect.isFalse(superE0.isOriginalDeclaration); |
92 Expect.isFalse(superInterfaceF.isOriginalDeclaration); | 92 Expect.isFalse(superInterfaceF.isOriginalDeclaration); |
93 Expect.isFalse(superInterfaceFF.isOriginalDeclaration); | 93 Expect.isFalse(superInterfaceFF.isOriginalDeclaration); |
94 | 94 |
95 Expect.equals(reflectClass(Object), superA); | 95 Expect.equals(reflectClass(Object), superA); |
96 Expect.equals(reflect(new A<U>()).type, superB); | 96 Expect.equals(reflect(new A<U>()).type, superB); |
97 Expect.equals(reflect(new A<C>()).type, superC); /// 01: ok | 97 Expect.equals(reflect(new A<C>()).type, superC); //# 01: ok |
98 Expect.equals(reflect(new A<U>()).type, superD); | 98 Expect.equals(reflect(new A<U>()).type, superD); |
99 Expect.equals(reflect(new G<H<R>>()).type, superE); | 99 Expect.equals(reflect(new G<H<R>>()).type, superE); |
100 Expect.equals(reflect(new G<H<H<R>>>()).type, superE0); | 100 Expect.equals(reflect(new G<H<H<R>>>()).type, superE0); |
101 Expect.equals(reflect(new G<H<R>>()).type, superInterfaceFF); | 101 Expect.equals(reflect(new G<H<R>>()).type, superInterfaceFF); |
102 Expect.equals(u, superB.typeArguments[0]); | 102 Expect.equals(u, superB.typeArguments[0]); |
103 Expect.equals(reflect(new C()).type, superC.typeArguments[0]); /// 01: ok | 103 Expect.equals(reflect(new C()).type, superC.typeArguments[0]); //# 01: ok |
104 Expect.equals(u, superD.typeArguments[0]); | 104 Expect.equals(u, superD.typeArguments[0]); |
105 Expect.equals(r, superE.typeArguments[0].typeArguments[0]); | 105 Expect.equals(r, superE.typeArguments[0].typeArguments[0]); |
106 Expect.equals(hr, superE0.typeArguments[0].typeArguments[0]); | 106 Expect.equals(hr, superE0.typeArguments[0].typeArguments[0]); |
107 Expect.equals(r, superInterfaceFF.typeArguments[0].typeArguments[0]); | 107 Expect.equals(r, superInterfaceFF.typeArguments[0].typeArguments[0]); |
108 Expect.equals(u, superInterfaceF.typeArguments[0]); | 108 Expect.equals(u, superInterfaceF.typeArguments[0]); |
109 } | 109 } |
110 | 110 |
111 void testObject() { | 111 void testObject() { |
112 ClassMirror object = reflectClass(Object); | 112 ClassMirror object = reflectClass(Object); |
113 Expect.equals(null, object.superclass); | 113 Expect.equals(null, object.superclass); |
114 } | 114 } |
115 | 115 |
116 main() { | 116 main() { |
117 testOriginals(); | 117 testOriginals(); |
118 testInstances(); | 118 testInstances(); |
119 testObject(); | 119 testObject(); |
120 } | 120 } |
OLD | NEW |