Skip to content

Commit

Permalink
Merge pull request #4 from dart-lang/rename-to-defineReflectiveTests
Browse files Browse the repository at this point in the history
Rename runReflectiveTests -> defineReflectiveTests.
  • Loading branch information
scheglov committed Apr 22, 2015
2 parents 87ef0be + 58e0d59 commit d7e0f5c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.DS_Store
.idea
.pub/
.project
.settings/
build/
packages
Expand Down
12 changes: 6 additions & 6 deletions lib/test_reflective_loader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'dart:async';
import 'package:unittest/unittest.dart';

/**
* Runs test methods existing in the given [type].
* Define tests using methods existing in the given [type].
*
* Methods with names starting with `test` are run using [test] function.
* Methods with names starting with `solo_test` are run using [solo_test] function.
Expand All @@ -26,13 +26,13 @@ import 'package:unittest/unittest.dart';
* method invocation. If method returns [Future] to test some asyncronous
* behavior, then `tearDown` will be invoked in `Future.complete`.
*/
void runReflectiveTests(Type type) {
void defineReflectiveTests(Type type) {
ClassMirror classMirror = reflectClass(type);
if (!classMirror.metadata.any((InstanceMirror annotation) =>
annotation.type.reflectedType == ReflectiveTest)) {
annotation.type.reflectedType == ReflectiveTest)) {
String name = MirrorSystem.getName(classMirror.qualifiedName);
throw new Exception('Class $name must have annotation "@reflectiveTest" '
'in order to be run by runReflectiveTests.');
'in order to be run by runReflectiveTests.');
}
String className = MirrorSystem.getName(classMirror.simpleName);
group(className, () {
Expand Down Expand Up @@ -102,8 +102,8 @@ Future _runFailingTest(ClassMirror classMirror, Symbol symbol) {
_runTest(ClassMirror classMirror, Symbol symbol) {
InstanceMirror instanceMirror = classMirror.newInstance(new Symbol(''), []);
return _invokeSymbolIfExists(instanceMirror, #setUp)
.then((_) => instanceMirror.invoke(symbol, []).reflectee)
.whenComplete(() => _invokeSymbolIfExists(instanceMirror, #tearDown));
.then((_) => instanceMirror.invoke(symbol, []).reflectee)
.whenComplete(() => _invokeSymbolIfExists(instanceMirror, #tearDown));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: test_reflective_loader
version: 0.0.2
version: 0.0.3
description: Support for discovering tests and test suites using reflection.
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/dart-lang/test_reflective_loader
Expand Down

0 comments on commit d7e0f5c

Please sign in to comment.