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

Side by Side Diff: tests/lib/mirrors/instantiate_abstract_class_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.instantiate_abstract_class; 5 library test.instantiate_abstract_class;
6 6
7 @MirrorsUsed(targets: const ["dart.core", AbstractClass])
7 import 'dart:mirrors'; 8 import 'dart:mirrors';
8 import 'package:expect/expect.dart'; 9 import 'package:expect/expect.dart';
9 10
10 11
11 assertInstanitationErrorOnGenerativeConstructors(classMirror) { 12 assertInstanitationErrorOnGenerativeConstructors(classMirror) {
12 classMirror.declarations.values.forEach((decl) { 13 classMirror.declarations.values.forEach((decl) {
13 if (decl is! MethodMirror) return; 14 if (decl is! MethodMirror) return;
14 if (!decl.isGenerativeConstructor) return; 15 if (!decl.isGenerativeConstructor) return;
15 var args = new List(decl.parameters.length); 16 var args = new List(decl.parameters.length);
16 Expect.throws(() => classMirror.newInstance(decl.constructorName, args), 17 Expect.throws(() => classMirror.newInstance(decl.constructorName, args),
(...skipping 20 matching lines...) Expand all
37 class ConcreteClass implements AbstractClass {} 38 class ConcreteClass implements AbstractClass {}
38 39
39 main() { 40 main() {
40 assertInstanitationErrorOnGenerativeConstructors(reflectType(num)); 41 assertInstanitationErrorOnGenerativeConstructors(reflectType(num));
41 assertInstanitationErrorOnGenerativeConstructors(reflectType(double)); 42 assertInstanitationErrorOnGenerativeConstructors(reflectType(double));
42 assertInstanitationErrorOnGenerativeConstructors(reflectType(StackTrace)); 43 assertInstanitationErrorOnGenerativeConstructors(reflectType(StackTrace));
43 44
44 assertInstanitationErrorOnGenerativeConstructors(reflectType(AbstractClass)); 45 assertInstanitationErrorOnGenerativeConstructors(reflectType(AbstractClass));
45 runFactoryConstructors(reflectType(AbstractClass)); 46 runFactoryConstructors(reflectType(AbstractClass));
46 } 47 }
OLDNEW
« no previous file with comments | « tests/lib/mirrors/instance_members_with_override_test.dart ('k') | tests/lib/mirrors/intercepted_cache_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698