From 58e0d599418d566c45e17f06256ff197f5842fb7 Mon Sep 17 00:00:00 2001 From: Konstantin Shcheglov Date: Wed, 22 Apr 2015 12:24:18 -0700 Subject: [PATCH] Rename runReflectiveTests -> defineReflectiveTests. --- .gitignore | 1 + lib/test_reflective_loader.dart | 12 ++++++------ pubspec.yaml | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index 89f7747..65b96be 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ .DS_Store .idea .pub/ +.project .settings/ build/ packages diff --git a/lib/test_reflective_loader.dart b/lib/test_reflective_loader.dart index 6ea195a..f8387e3 100644 --- a/lib/test_reflective_loader.dart +++ b/lib/test_reflective_loader.dart @@ -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. @@ -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, () { @@ -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)); } /** diff --git a/pubspec.yaml b/pubspec.yaml index d1c014e..60d4ec8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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 homepage: https://github.com/dart-lang/test_reflective_loader