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