diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e454018d..2ba4f2be5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +##0.11.6+2 + +* Fix all strong mode warnings. + ##0.11.6+1 * Give tests more time to start running. diff --git a/lib/src/matcher/iterable_matchers.dart b/lib/src/matcher/iterable_matchers.dart index 6a759ec57..22465f647 100644 --- a/lib/src/matcher/iterable_matchers.dart +++ b/lib/src/matcher/iterable_matchers.dart @@ -120,8 +120,8 @@ class _UnorderedEquals extends _UnorderedMatches { final List _expectedValues; _UnorderedEquals(Iterable expected) - : super(expected.map(equals)), - _expectedValues = expected.toList(); + : _expectedValues = expected.toList(), + super(expected.map(equals)); Description describe(Description description) => description .add('equals ') diff --git a/lib/src/matcher/operator_matchers.dart b/lib/src/matcher/operator_matchers.dart index 432f905eb..967f3fdef 100644 --- a/lib/src/matcher/operator_matchers.dart +++ b/lib/src/matcher/operator_matchers.dart @@ -90,24 +90,8 @@ class _AnyOf extends Matcher { description.addAll('(', ' or ', ')', _matchers); } -List _wrapArgs(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { - Iterable matchers; - if (arg0 is List) { - if (arg1 != null || - arg2 != null || - arg3 != null || - arg4 != null || - arg5 != null || - arg6 != null) { - throw new ArgumentError('If arg0 is a List, all other arguments must be' - ' null.'); - } - - matchers = arg0; - } else { - matchers = - [arg0, arg1, arg2, arg3, arg4, arg5, arg6].where((e) => e != null); - } - - return matchers.map((e) => wrapMatcher(e)).toList(); -} +List _wrapArgs(arg0, arg1, arg2, arg3, arg4, arg5, arg6) => + [arg0, arg1, arg2, arg3, arg4, arg5, arg6] + .where((e) => e != null) + .map((e) => wrapMatcher(e)) + .toList(); diff --git a/lib/src/matcher/util.dart b/lib/src/matcher/util.dart index b98c1a84a..1550974d0 100644 --- a/lib/src/matcher/util.dart +++ b/lib/src/matcher/util.dart @@ -7,6 +7,8 @@ library unittest.matcher.util; import 'core_matchers.dart'; import 'interfaces.dart'; +typedef bool _Predicate(value); + /// A [Map] between whitespace characters and their escape sequences. const _escapeMap = const { '\n': r'\n', @@ -38,7 +40,7 @@ void addStateInfo(Map matchState, Map values) { Matcher wrapMatcher(x) { if (x is Matcher) { return x; - } else if (x is Function) { + } else if (x is _Predicate) { return predicate(x); } else { return equals(x); diff --git a/lib/unittest.dart b/lib/unittest.dart index 51ccff432..8cf87190a 100644 --- a/lib/unittest.dart +++ b/lib/unittest.dart @@ -267,6 +267,8 @@ void handleExternalError(e, String message, [stackTrace]) { } } +typedef bool _TestFilter(InternalTestCase arg); + /// Remove any tests that match [testFilter]. /// /// [testFilter] can be a predicate function, a [RegExp], or a [String]. If it's @@ -276,13 +278,13 @@ void handleExternalError(e, String message, [stackTrace]) { /// This is different from enabling or disabling tests in that it removes the /// tests completely. void filterTests(testFilter) { - var filterFunction; + _TestFilter filterFunction; if (testFilter is String) { var re = new RegExp(testFilter); filterFunction = (t) => re.hasMatch(t.description); } else if (testFilter is RegExp) { filterFunction = (t) => testFilter.hasMatch(t.description); - } else if (testFilter is Function) { + } else if (testFilter is _TestFilter) { filterFunction = testFilter; } environment.testCases.retainWhere(filterFunction); diff --git a/pubspec.yaml b/pubspec.yaml index 0f971d238..35e6b451b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: unittest -version: 0.11.6+1 +version: 0.11.6+2 author: Dart Team description: A library for writing dart unit tests. homepage: https://github.com/dart-lang/old_unittest