Skip to content

Commit 7beae72

Browse files
committed
Fix strong mode warnings.
1 parent 298ab0e commit 7beae72

File tree

6 files changed

+19
-27
lines changed

6 files changed

+19
-27
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
##0.11.6+2
2+
3+
* Fix all strong mode warnings.
4+
15
##0.11.6+1
26

37
* Give tests more time to start running.

lib/src/matcher/iterable_matchers.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ class _UnorderedEquals extends _UnorderedMatches {
120120
final List _expectedValues;
121121

122122
_UnorderedEquals(Iterable expected)
123-
: super(expected.map(equals)),
124-
_expectedValues = expected.toList();
123+
: _expectedValues = expected.toList(),
124+
super(expected.map(equals));
125125

126126
Description describe(Description description) => description
127127
.add('equals ')

lib/src/matcher/operator_matchers.dart

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -90,24 +90,8 @@ class _AnyOf extends Matcher {
9090
description.addAll('(', ' or ', ')', _matchers);
9191
}
9292

93-
List<Matcher> _wrapArgs(arg0, arg1, arg2, arg3, arg4, arg5, arg6) {
94-
Iterable<Matcher> matchers;
95-
if (arg0 is List) {
96-
if (arg1 != null ||
97-
arg2 != null ||
98-
arg3 != null ||
99-
arg4 != null ||
100-
arg5 != null ||
101-
arg6 != null) {
102-
throw new ArgumentError('If arg0 is a List, all other arguments must be'
103-
' null.');
104-
}
105-
106-
matchers = arg0;
107-
} else {
108-
matchers =
109-
[arg0, arg1, arg2, arg3, arg4, arg5, arg6].where((e) => e != null);
110-
}
111-
112-
return matchers.map((e) => wrapMatcher(e)).toList();
113-
}
93+
List<Matcher> _wrapArgs(arg0, arg1, arg2, arg3, arg4, arg5, arg6) =>
94+
[arg0, arg1, arg2, arg3, arg4, arg5, arg6]
95+
.where((e) => e != null)
96+
.map((e) => wrapMatcher(e))
97+
.toList();

lib/src/matcher/util.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ library unittest.matcher.util;
77
import 'core_matchers.dart';
88
import 'interfaces.dart';
99

10+
typedef bool _Predicate(value);
11+
1012
/// A [Map] between whitespace characters and their escape sequences.
1113
const _escapeMap = const {
1214
'\n': r'\n',
@@ -38,7 +40,7 @@ void addStateInfo(Map matchState, Map values) {
3840
Matcher wrapMatcher(x) {
3941
if (x is Matcher) {
4042
return x;
41-
} else if (x is Function) {
43+
} else if (x is _Predicate) {
4244
return predicate(x);
4345
} else {
4446
return equals(x);

lib/unittest.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,8 @@ void handleExternalError(e, String message, [stackTrace]) {
267267
}
268268
}
269269

270+
typedef bool _TestFilter(InternalTestCase arg);
271+
270272
/// Remove any tests that match [testFilter].
271273
///
272274
/// [testFilter] can be a predicate function, a [RegExp], or a [String]. If it's
@@ -276,13 +278,13 @@ void handleExternalError(e, String message, [stackTrace]) {
276278
/// This is different from enabling or disabling tests in that it removes the
277279
/// tests completely.
278280
void filterTests(testFilter) {
279-
var filterFunction;
281+
_TestFilter filterFunction;
280282
if (testFilter is String) {
281283
var re = new RegExp(testFilter);
282284
filterFunction = (t) => re.hasMatch(t.description);
283285
} else if (testFilter is RegExp) {
284286
filterFunction = (t) => testFilter.hasMatch(t.description);
285-
} else if (testFilter is Function) {
287+
} else if (testFilter is _TestFilter) {
286288
filterFunction = testFilter;
287289
}
288290
environment.testCases.retainWhere(filterFunction);

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: unittest
2-
version: 0.11.6+1
2+
version: 0.11.6+2
33
author: Dart Team <[email protected]>
44
description: A library for writing dart unit tests.
55
homepage: https://github.com/dart-lang/old_unittest

0 commit comments

Comments
 (0)