Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(341)

Side by Side Diff: tests/lib/mirrors/generics_double_substitution_test.dart

Issue 2727323002: Add @MirrorsUsed annotations to speed up tests. (Closed)
Patch Set: Minor fixes. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 library test.generics_double_substitution; 5 library test.generics_double_substitution;
6 6
7 @MirrorsUsed(targets: "test.generics_double_substitution")
7 import 'dart:mirrors'; 8 import 'dart:mirrors';
8 import 'package:expect/expect.dart'; 9 import 'package:expect/expect.dart';
9 10
10 class A<R> {} 11 class A<R> {}
11 class B<S> {} 12 class B<S> {}
12 class C<T> extends B<A<T>> { 13 class C<T> extends B<A<T>> {
13 A<T> field; 14 A<T> field;
14 A<T> returnType() {} 15 A<T> returnType() {}
15 parameterType(A<T> param) {} 16 parameterType(A<T> param) {}
16 } 17 }
17 18
18 main() { 19 main() {
19 ClassMirror cOfString = reflect(new C<String>()).type; 20 ClassMirror cOfString = reflect(new C<String>()).type;
20 ClassMirror aOfString = reflect(new A<String>()).type; 21 ClassMirror aOfString = reflect(new A<String>()).type;
21 22
22 VariableMirror field = cOfString.declarations[#field]; 23 VariableMirror field = cOfString.declarations[#field];
23 Expect.equals(aOfString, field.type); 24 Expect.equals(aOfString, field.type);
24 25
25 MethodMirror returnType = cOfString.declarations[#returnType]; 26 MethodMirror returnType = cOfString.declarations[#returnType];
26 Expect.equals(aOfString, returnType.returnType); 27 Expect.equals(aOfString, returnType.returnType);
27 28
28 MethodMirror parameterType = cOfString.declarations[#parameterType]; 29 MethodMirror parameterType = cOfString.declarations[#parameterType];
29 Expect.equals(aOfString, parameterType.parameters.single.type); 30 Expect.equals(aOfString, parameterType.parameters.single.type);
30 31
31 ClassMirror typeArgOfSuperclass = cOfString.superclass.typeArguments.single; 32 ClassMirror typeArgOfSuperclass = cOfString.superclass.typeArguments.single;
32 Expect.equals(aOfString, typeArgOfSuperclass); /// 01: ok 33 Expect.equals(aOfString, typeArgOfSuperclass); /// 01: ok
33 } 34 }
OLDNEW
« no previous file with comments | « tests/lib/mirrors/generic_superclass_test.dart ('k') | tests/lib/mirrors/generics_dynamic_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698