Fix most strong mode errors in lib/; LineSplitter issue remains (#33)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 695e191..40bfbdb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,9 @@
+## 0.12.11
+
+* Fix most strong mode errors and warnings.
+* Support `test` version `0.12.20`
+* Minimum Dart SDK version is now `1.22.0`.
+
## 0.12.10+1
* Hide the `StreamMatcher` class from the `test` package.
diff --git a/lib/scheduled_test.dart b/lib/scheduled_test.dart
index 305e763..48dc68b 100644
--- a/lib/scheduled_test.dart
+++ b/lib/scheduled_test.dart
@@ -174,7 +174,7 @@
/// on the next event loop iteration rather than adding it to a queue. The
/// current task will not complete until [fn] (and any [Future] it returns) has
/// finished running.
-Future/*<T>*/ schedule/*<T>*/(/*=T*/ fn(), [String description]) =>
+Future<T> schedule<T>(T fn(), [String description]) =>
currentSchedule.tasks.schedule(fn, description);
/// Register a [setUp] function for a test [group].
diff --git a/lib/src/schedule.dart b/lib/src/schedule.dart
index 3143163..3c14b6d 100644
--- a/lib/src/schedule.dart
+++ b/lib/src/schedule.dart
@@ -220,21 +220,21 @@
/// known as a "nested task". The current task will not complete until [fn]
/// (and any [Future] it returns) has finished running. Nested tasks run in
/// parallel, unlike top-level tasks which run in sequence.
- Future/*<T>*/ schedule/*<T>*/(/*=T*/ fn(), [String description]) {
+ Future<T> schedule<T>(T fn(), [String description]) {
if (isRunning) {
var task = _schedule.currentTask;
- var wrappedFn = () {
- var whenDone = test.expectAsync(() {});
+ TaskBody<T> wrappedFn = () {
+ var whenDone = test.expectAsync0(() {});
return new Future.value().then((_) => fn()).then((result) {
whenDone();
return result;
});
};
if (task == null) return wrappedFn();
- return task.runChild/*<Future<T>>*/(wrappedFn, description);
+ return task.runChild(wrappedFn, description);
}
- var task = new Task/*<T>*/(fn, description, this);
+ var task = new Task<T>(fn, description, this);
_contents.add(task);
return task.result;
}
diff --git a/lib/src/task.dart b/lib/src/task.dart
index de3c7e5..21eeb4d 100644
--- a/lib/src/task.dart
+++ b/lib/src/task.dart
@@ -76,7 +76,7 @@
}
_state = TaskState.RUNNING;
- var future = new Future<T>.sync(fn).then((value) {
+ var future = new Future<T>.sync(fn).then<T>((value) {
if (_childGroup == null || _childGroup.completed) return value;
return _childGroup.future.then((_) => value);
});
@@ -94,8 +94,8 @@
/// Run [fn] as a child of this task. Returns a Future that will complete with
/// the result of the child task. This task will not complete until [fn] has
/// finished.
- Future/*<S>*/ runChild/*<S>*/(/*=S*/ fn(), String description) {
- var task = new Task/*<S>*/._child(fn, description, this);
+ Future<S> runChild<S>(Future<S> fn(), String description) {
+ var task = new Task<S>._child(fn, description, this);
_children.add(task);
if (_childGroup == null || _childGroup.completed) {
_childGroup = new FutureGroup();
diff --git a/lib/src/utils.dart b/lib/src/utils.dart
index b8965d6..1d21567 100644
--- a/lib/src/utils.dart
+++ b/lib/src/utils.dart
@@ -258,8 +258,8 @@
return new Chain.forTrace(trace).terse.toString().trim();
}
-StreamTransformer/*<S2, T2>*/ converterTransformer/*<S1, T1, S2, T2>*/(
- ChunkedConverter/*<S1, T1, S2, T2>*/ converter) {
+StreamTransformer<S, T> converterTransformer<S, T>(
+ Converter<S, T> converter) {
return new StreamTransformer((stream, cancelOnError) {
return converter.bind(stream).listen(null, cancelOnError: cancelOnError);
});
diff --git a/lib/src/value_future.dart b/lib/src/value_future.dart
index eec5c54..0fcd95d 100644
--- a/lib/src/value_future.dart
+++ b/lib/src/value_future.dart
@@ -28,9 +28,9 @@
}
Stream<T> asStream() => _future.asStream();
- Future catchError(Function onError, {bool test(Object error)}) =>
+ Future<T> catchError(Function onError, {bool test(Object error)}) =>
_future.catchError(onError, test: test);
- Future/*<S>*/ then/*<S>*/(/*=S*/ onValue(T value), {Function onError}) =>
+ Future<S> then<S>(FutureOr<S> onValue(T value), {Function onError}) =>
_future.then(onValue, onError: onError);
Future<T> whenComplete(action()) => _future.whenComplete(action);
Future<T> timeout(Duration timeLimit, {void onTimeout()}) =>
diff --git a/pubspec.yaml b/pubspec.yaml
index acc73c4..2447856 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: scheduled_test
-version: 0.12.10+1
+version: 0.12.11
author: Dart Team <misc@dartlang.org>
description: >
A package for writing readable tests of asynchronous behavior.
@@ -10,7 +10,7 @@
homepage: https://github.com/dart-lang/scheduled_test
environment:
- sdk: '>=1.16.0 <2.0.0'
+ sdk: '>=1.22.0 <2.0.0'
dependencies:
async: '^1.10.0'
collection: '^1.5.0'
@@ -23,7 +23,7 @@
# Because scheduled_test exports test, it needs to keep its version constraint
# tight to ensure that a constraint on scheduled_test properly constraints all
# features it provides.
- test: '>=0.12.19 <0.12.20'
+ test: '>=0.12.20 <0.12.21'
dev_dependencies:
metatest: "^0.2.1"
shelf_web_socket: "^0.2.0"