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