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 class A<T> {} | 9 class A<T> {} |
9 | 10 class B extends A<U>{} |
10 class B extends A<U> {} | |
11 | |
12 class C extends A<C> {} | 11 class C extends A<C> {} |
13 | |
14 class D<T> extends A<T> {} | 12 class D<T> extends A<T> {} |
15 | 13 class E<X,Y> extends G<H<Y>> {} |
16 class E<X, Y> extends G<H<Y>> {} | |
17 | |
18 class F<X> implements A<X> {} | 14 class F<X> implements A<X> {} |
19 | 15 class FF<X,Y> implements G<H<Y>> {} |
20 class FF<X, Y> implements G<H<Y>> {} | |
21 | |
22 class G<T> {} | 16 class G<T> {} |
23 | |
24 class H<T> {} | 17 class H<T> {} |
25 | |
26 class U {} | 18 class U {} |
27 | |
28 class R {} | 19 class R {} |
29 | 20 |
30 void testOriginals() { | 21 void testOriginals() { |
31 ClassMirror a = reflectClass(A); | 22 ClassMirror a = reflectClass(A); |
32 ClassMirror b = reflectClass(B); | 23 ClassMirror b = reflectClass(B); |
33 ClassMirror c = reflectClass(C); | 24 ClassMirror c = reflectClass(C); |
34 ClassMirror d = reflectClass(D); | 25 ClassMirror d = reflectClass(D); |
35 ClassMirror e = reflectClass(E); | 26 ClassMirror e = reflectClass(E); |
36 ClassMirror f = reflectClass(F); | 27 ClassMirror f = reflectClass(F); |
37 ClassMirror ff = reflectClass(FF); | 28 ClassMirror ff = reflectClass(FF); |
(...skipping 30 matching lines...) Expand all Loading... |
68 Expect.equals(eY, superE.typeArguments[0].typeArguments[0]); | 59 Expect.equals(eY, superE.typeArguments[0].typeArguments[0]); |
69 Expect.equals(feY, superInterfaceFF.typeArguments[0].typeArguments[0]); | 60 Expect.equals(feY, superInterfaceFF.typeArguments[0].typeArguments[0]); |
70 Expect.equals(fX, superInterfaceF.typeArguments[0]); | 61 Expect.equals(fX, superInterfaceF.typeArguments[0]); |
71 } | 62 } |
72 | 63 |
73 void testInstances() { | 64 void testInstances() { |
74 ClassMirror a = reflect(new A<U>()).type; | 65 ClassMirror a = reflect(new A<U>()).type; |
75 ClassMirror b = reflect(new B()).type; | 66 ClassMirror b = reflect(new B()).type; |
76 ClassMirror c = reflect(new C()).type; | 67 ClassMirror c = reflect(new C()).type; |
77 ClassMirror d = reflect(new D<U>()).type; | 68 ClassMirror d = reflect(new D<U>()).type; |
78 ClassMirror e = reflect(new E<U, R>()).type; | 69 ClassMirror e = reflect(new E<U,R>()).type; |
79 ClassMirror e0 = reflect(new E<U, H<R>>()).type; | 70 ClassMirror e0 = reflect(new E<U,H<R>>()).type; |
80 ClassMirror ff = reflect(new FF<U, R>()).type; | 71 ClassMirror ff = reflect(new FF<U,R>()).type; |
81 ClassMirror f = reflect(new F<U>()).type; | 72 ClassMirror f = reflect(new F<U>()).type; |
82 ClassMirror u = reflect(new U()).type; | 73 ClassMirror u = reflect(new U()).type; |
83 ClassMirror r = reflect(new R()).type; | 74 ClassMirror r = reflect(new R()).type; |
84 ClassMirror hr = reflect(new H<R>()).type; | 75 ClassMirror hr = reflect(new H<R>()).type; |
85 | 76 |
86 ClassMirror superA = a.superclass; | 77 ClassMirror superA = a.superclass; |
87 ClassMirror superB = b.superclass; | 78 ClassMirror superB = b.superclass; |
88 ClassMirror superC = c.superclass; | 79 ClassMirror superC = c.superclass; |
89 ClassMirror superD = d.superclass; | 80 ClassMirror superD = d.superclass; |
90 ClassMirror superE = e.superclass; | 81 ClassMirror superE = e.superclass; |
(...skipping 28 matching lines...) Expand all Loading... |
119 | 110 |
120 void testObject() { | 111 void testObject() { |
121 ClassMirror object = reflectClass(Object); | 112 ClassMirror object = reflectClass(Object); |
122 Expect.equals(null, object.superclass); | 113 Expect.equals(null, object.superclass); |
123 } | 114 } |
124 | 115 |
125 main() { | 116 main() { |
126 testOriginals(); | 117 testOriginals(); |
127 testInstances(); | 118 testInstances(); |
128 testObject(); | 119 testObject(); |
129 } | 120 } |
OLD | NEW |