prep to publish 0.2.1
diff --git a/.status b/.status
deleted file mode 100644
index 364ca4b..0000000
--- a/.status
+++ /dev/null
@@ -1,4 +0,0 @@
-# Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-# for details. All rights reserved. Use of this source code is governed by a
-# BSD-style license that can be found in the LICENSE file.
-
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0395858..05195a8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,4 @@
-## 0.2.1-dev
+## 0.2.1
- Use package:lints for analysis.
- Populate the pubspec `repository` field.
diff --git a/README.md b/README.md
index b7f5e19..f7d07db 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,5 @@
-# test_reflective_loader
-
[![Build Status](https://github.com/dart-lang/test_reflective_loader/workflows/Dart/badge.svg)](https://github.com/dart-lang/test_reflective_loader/actions)
+[![pub package](https://img.shields.io/pub/v/test_reflective_loader.svg)](https://pub.dev/packages/test_reflective_loader)
Support for discovering tests and test suites using reflection.
diff --git a/analysis_options.yaml b/analysis_options.yaml
index 31466c3..fc2a9d3 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -1,4 +1,8 @@
-include: package:lints/core.yaml
+include: package:lints/recommended.yaml
+
+analyzer:
+ errors:
+ slash_for_doc_comments: ignore
linter:
rules:
diff --git a/lib/test_reflective_loader.dart b/lib/test_reflective_loader.dart
index e03eb7a..77a2447 100644
--- a/lib/test_reflective_loader.dart
+++ b/lib/test_reflective_loader.dart
@@ -13,28 +13,28 @@
* A marker annotation used to annotate test methods which are expected to fail
* when asserts are enabled.
*/
-const _AssertFailingTest assertFailingTest = const _AssertFailingTest();
+const _AssertFailingTest assertFailingTest = _AssertFailingTest();
/**
* A marker annotation used to annotate test methods which are expected to fail.
*/
-const FailingTest failingTest = const FailingTest();
+const FailingTest failingTest = FailingTest();
/**
* A marker annotation used to instruct dart2js to keep reflection information
* for the annotated classes.
*/
-const _ReflectiveTest reflectiveTest = const _ReflectiveTest();
+const _ReflectiveTest reflectiveTest = _ReflectiveTest();
/**
* A marker annotation used to annotate test methods that should be skipped.
*/
-const SkippedTest skippedTest = const SkippedTest();
+const SkippedTest skippedTest = SkippedTest();
/**
* A marker annotation used to annotate "solo" groups and tests.
*/
-const _SoloTest soloTest = const _SoloTest();
+const _SoloTest soloTest = _SoloTest();
final List<_Group> _currentGroups = <_Group>[];
int _currentSuiteLevel = 0;
@@ -58,7 +58,7 @@
* create embedded suites. If the current suite is the top-level one, perform
* check for "solo" groups and tests, and run all or only "solo" items.
*/
-void defineReflectiveSuite(void define(), {String name = ''}) {
+void defineReflectiveSuite(void Function() define, {String name = ''}) {
String groupName = _currentSuiteName;
_currentSuiteLevel++;
try {
@@ -96,7 +96,7 @@
if (!classMirror.metadata.any((InstanceMirror annotation) =>
annotation.type.reflectedType == _ReflectiveTest)) {
String name = MirrorSystem.getName(classMirror.qualifiedName);
- throw new Exception('Class $name must have annotation "@reflectiveTest" '
+ throw Exception('Class $name must have annotation "@reflectiveTest" '
'in order to be run by runReflectiveTests.');
}
@@ -104,7 +104,7 @@
{
bool isSolo = _hasAnnotationInstance(classMirror, soloTest);
String className = MirrorSystem.getName(classMirror.simpleName);
- group = new _Group(isSolo, _combineNames(_currentSuiteName, className));
+ group = _Group(isSolo, _combineNames(_currentSuiteName, className));
_currentGroups.add(group);
}
@@ -229,16 +229,18 @@
Future<Object?> _invokeSymbolIfExists(
InstanceMirror instanceMirror, Symbol symbol) {
- Object? invocationResult = null;
+ Object? invocationResult;
InstanceMirror? closure;
try {
closure = instanceMirror.getField(symbol);
- } on NoSuchMethodError {}
+ } on NoSuchMethodError {
+ // ignore
+ }
if (closure is ClosureMirror) {
invocationResult = closure.apply([]).reflectee;
}
- return new Future.value(invocationResult);
+ return Future.value(invocationResult);
}
/**
@@ -252,7 +254,7 @@
Future<Object?>? _runFailingTest(ClassMirror classMirror, Symbol symbol) {
bool passed = false;
return runZonedGuarded(() {
- return new Future.sync(() => _runTest(classMirror, symbol)).then<void>((_) {
+ return Future.sync(() => _runTest(classMirror, symbol)).then((_) {
passed = true;
test_package.fail('Test passed - expected to fail.');
}).catchError((e) {
@@ -272,7 +274,7 @@
}
Future<Object?> _runTest(ClassMirror classMirror, Symbol symbol) {
- InstanceMirror instanceMirror = classMirror.newInstance(new Symbol(''), []);
+ InstanceMirror instanceMirror = classMirror.newInstance(Symbol(''), []);
return _invokeSymbolIfExists(instanceMirror, #setUp)
.then((_) => instanceMirror.invoke(symbol, []).reflectee)
.whenComplete(() => _invokeSymbolIfExists(instanceMirror, #tearDown));
@@ -341,7 +343,7 @@
void addSkippedTest(String name) {
var fullName = _combineNames(this.name, name);
- tests.add(new _Test.skipped(isSolo, fullName));
+ tests.add(_Test.skipped(isSolo, fullName));
}
void addTest(bool isSolo, String name, MethodMirror memberMirror,
@@ -349,7 +351,7 @@
var fullName = _combineNames(this.name, name);
var timeout =
_getAnnotationInstance(memberMirror, TestTimeout) as TestTimeout?;
- tests.add(new _Test(isSolo, fullName, function, timeout?._timeout));
+ tests.add(_Test(isSolo, fullName, function, timeout?._timeout));
}
}
diff --git a/pubspec.yaml b/pubspec.yaml
index 51cb753..57cf02b 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: test_reflective_loader
-version: 0.2.1-dev
+version: 0.2.1
description: Support for discovering tests and test suites using reflection.
repository: https://github.com/dart-lang/test_reflective_loader
@@ -8,4 +8,4 @@
dependencies:
lints: ^1.0.0
- test: '>=1.16.0 <2.0.0'
+ test: ^1.16.0
diff --git a/test/test_reflective_loader_test.dart b/test/test_reflective_loader_test.dart
index d303a75..ea7911f 100644
--- a/test/test_reflective_loader_test.dart
+++ b/test/test_reflective_loader_test.dart
@@ -33,7 +33,7 @@
@failingTest
Future test_fails_throws_async() {
- return new Future.error('foo');
+ return Future.error('foo');
}
@skippedTest