Chromium Code Reviews| Index: tests/lib/mirrors/class_mirror_type_variables_test.dart |
| diff --git a/tests/lib/mirrors/class_mirror_type_variables_test.dart b/tests/lib/mirrors/class_mirror_type_variables_test.dart |
| index ee7baf95b8def14d0b03a87d9c43dd527904cea4..628ce97b2bc6751f68b325ec1f98ced70702e083 100644 |
| --- a/tests/lib/mirrors/class_mirror_type_variables_test.dart |
| +++ b/tests/lib/mirrors/class_mirror_type_variables_test.dart |
| @@ -6,15 +6,51 @@ import "dart:mirrors"; |
| import "package:expect/expect.dart"; |
| +class NoTypeParams {} |
| +class A<T, S extends String> {} |
| +class B<Z extends B<Z>> {} |
| class C<R,S,T> { |
| R foo(R r) => r; |
| S bar(S s) => s; |
| T baz(T t) => t; |
| } |
| -class NoTypeParams {} |
| - |
| main() { |
|
ahe
2013/10/14 13:07:07
Please move main to the end of the file.
zarah
2013/10/15 14:20:02
Done.
|
| + testNoTypeParams(); |
| + testA(); |
| + testB(); |
| + testC(); |
| +} |
| + |
| +testNoTypeParams() { |
| + ClassMirror cm = reflectClass(NoTypeParams); |
| + Expect.equals(cm.typeVariables.length, 0); |
| +} |
| + |
| +void testA() { |
| + ClassMirror a = reflectClass(A); |
| + Expect.equals(2, a.typeVariables.length); |
| + |
| + TypeVariableMirror aT = a.typeVariables[0]; |
| + TypeVariableMirror aS = a.typeVariables[1]; |
| + TypeMirror aTBound = aT.upperBound.originalDeclaration; |
| + TypeMirror aSBound = aS.upperBound.originalDeclaration; |
| + |
| + Expect.equals(reflectClass(Object), aTBound); |
| + Expect.equals(reflectClass(String), aSBound); |
| +} |
| + |
| +void testB() { |
| + ClassMirror b = reflectClass(B); |
| + Expect.equals(1, b.typeVariables.length); |
| + |
| + TypeVariableMirror bZ = b.typeVariables[0]; |
| + ClassMirror bZBound = bZ.upperBound.originalDeclaration; |
| + Expect.equals(b, bZBound); |
| + Expect.equals(bZ, bZBound.typeVariables[0]); |
| +} |
| + |
| +testC() { |
| ClassMirror cm; |
| cm = reflectClass(C); |
| Expect.equals(3, cm.typeVariables.length); |
| @@ -25,6 +61,4 @@ main() { |
| Expect.equals(#R, values.elementAt(0).simpleName); |
| Expect.equals(#S, values.elementAt(1).simpleName); |
| Expect.equals(#T, values.elementAt(2).simpleName); |
| - cm = reflectClass(NoTypeParams); |
| - Expect.equals(cm.typeVariables.length, 0); |
| } |