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

Side by Side Diff: pkg/analyzer/test/reflective_tests.dart

Issue 742273005: Annotate remaining analyzer/analysis server tests with "@ReflectiveTestCase()" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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 | Annotate | Revision Log
« no previous file with comments | « pkg/analyzer/test/generated/static_warning_code_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 reflective_tests; 5 library reflective_tests;
6 6
7 @MirrorsUsed(metaTargets: 'ReflectiveTestCase') 7 @MirrorsUsed(metaTargets: 'ReflectiveTestCase')
8 import 'dart:mirrors'; 8 import 'dart:mirrors';
9 import 'dart:async'; 9 import 'dart:async';
10 10
(...skipping 11 matching lines...) Expand all
22 * 22 *
23 * If [type] declares method `setUp`, it methods will be invoked before any test 23 * If [type] declares method `setUp`, it methods will be invoked before any test
24 * method invocation. 24 * method invocation.
25 * 25 *
26 * If [type] declares method `tearDown`, it will be invoked after any test 26 * If [type] declares method `tearDown`, it will be invoked after any test
27 * method invocation. If method returns [Future] to test some asyncronous 27 * method invocation. If method returns [Future] to test some asyncronous
28 * behavior, then `tearDown` will be invoked in `Future.complete`. 28 * behavior, then `tearDown` will be invoked in `Future.complete`.
29 */ 29 */
30 void runReflectiveTests(Type type) { 30 void runReflectiveTests(Type type) {
31 ClassMirror classMirror = reflectClass(type); 31 ClassMirror classMirror = reflectClass(type);
32 if (!classMirror.metadata.any(
33 (InstanceMirror annotation) =>
34 annotation.type.reflectedType == ReflectiveTestCase)) {
35 String name = MirrorSystem.getName(classMirror.qualifiedName);
36 throw new Exception(
37 'Class $name must have annotation "@ReflectiveTestCase()" '
38 'in order to be run by runReflectiveTests.');
39 }
32 String className = MirrorSystem.getName(classMirror.simpleName); 40 String className = MirrorSystem.getName(classMirror.simpleName);
33 group(className, () { 41 group(className, () {
34 classMirror.instanceMembers.forEach((symbol, memberMirror) { 42 classMirror.instanceMembers.forEach((symbol, memberMirror) {
35 // we need only methods 43 // we need only methods
36 if (memberMirror is! MethodMirror || !memberMirror.isRegularMethod) { 44 if (memberMirror is! MethodMirror || !memberMirror.isRegularMethod) {
37 return; 45 return;
38 } 46 }
39 String memberName = MirrorSystem.getName(symbol); 47 String memberName = MirrorSystem.getName(symbol);
40 // test_ 48 // test_
41 if (memberName.startsWith('test_')) { 49 if (memberName.startsWith('test_')) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } 120 }
113 121
114 122
115 /** 123 /**
116 * A marker annotation used to instruct dart2js to keep reflection information 124 * A marker annotation used to instruct dart2js to keep reflection information
117 * for the annotated classes. 125 * for the annotated classes.
118 */ 126 */
119 class ReflectiveTestCase { 127 class ReflectiveTestCase {
120 const ReflectiveTestCase(); 128 const ReflectiveTestCase();
121 } 129 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/static_warning_code_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698