| OLD | NEW |
| 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 21 matching lines...) Expand all Loading... |
| 32 String className = MirrorSystem.getName(classMirror.simpleName); | 32 String className = MirrorSystem.getName(classMirror.simpleName); |
| 33 group(className, () { | 33 group(className, () { |
| 34 classMirror.instanceMembers.forEach((symbol, memberMirror) { | 34 classMirror.instanceMembers.forEach((symbol, memberMirror) { |
| 35 // we need only methods | 35 // we need only methods |
| 36 if (memberMirror is! MethodMirror || !memberMirror.isRegularMethod) { | 36 if (memberMirror is! MethodMirror || !memberMirror.isRegularMethod) { |
| 37 return; | 37 return; |
| 38 } | 38 } |
| 39 String memberName = MirrorSystem.getName(symbol); | 39 String memberName = MirrorSystem.getName(symbol); |
| 40 // test_ | 40 // test_ |
| 41 if (memberName.startsWith('test_')) { | 41 if (memberName.startsWith('test_')) { |
| 42 String testName = memberName.substring('test_'.length); | 42 test(memberName, () { |
| 43 test(testName, () { | |
| 44 return _runTest(classMirror, symbol); | 43 return _runTest(classMirror, symbol); |
| 45 }); | 44 }); |
| 46 return; | 45 return; |
| 47 } | 46 } |
| 48 // solo_test_ | 47 // solo_test_ |
| 49 if (memberName.startsWith('solo_test_')) { | 48 if (memberName.startsWith('solo_test_')) { |
| 50 String testName = memberName.substring('solo_test_'.length); | 49 solo_test(memberName, () { |
| 51 solo_test(testName, () { | |
| 52 return _runTest(classMirror, symbol); | 50 return _runTest(classMirror, symbol); |
| 53 }); | 51 }); |
| 54 } | 52 } |
| 55 }); | 53 }); |
| 56 }); | 54 }); |
| 57 } | 55 } |
| 58 | 56 |
| 59 | 57 |
| 60 Future _invokeSymbolIfExists(InstanceMirror instanceMirror, Symbol symbol) { | 58 Future _invokeSymbolIfExists(InstanceMirror instanceMirror, Symbol symbol) { |
| 61 var invocationResult = null; | 59 var invocationResult = null; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 85 } | 83 } |
| 86 | 84 |
| 87 | 85 |
| 88 /** | 86 /** |
| 89 * A marker annotation used to instruct dart2js to keep reflection information | 87 * A marker annotation used to instruct dart2js to keep reflection information |
| 90 * for the annotated classes. | 88 * for the annotated classes. |
| 91 */ | 89 */ |
| 92 class ReflectiveTestCase { | 90 class ReflectiveTestCase { |
| 93 const ReflectiveTestCase(); | 91 const ReflectiveTestCase(); |
| 94 } | 92 } |
| OLD | NEW |