diff --git a/CHANGELOG.md b/CHANGELOG.md index 86345fe..3c2a25e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.11.4+6 + +* Fix a bug introduced in 0.11.4+5 in which operator matchers broke when taking + lists of matchers. + ## 0.11.4+5 * Fix all strong-mode warnings. diff --git a/lib/src/operator_matchers.dart b/lib/src/operator_matchers.dart index f0a4c08..6d2e1fe 100644 --- a/lib/src/operator_matchers.dart +++ b/lib/src/operator_matchers.dart @@ -90,8 +90,23 @@ class _AnyOf extends Matcher { description.addAll('(', ' or ', ')', _matchers); } -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(); +List _wrapArgs(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { + Iterable args; + 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.'); + } + + args = arg0; + } else { + args = [arg0, arg1, arg2, arg3, arg4, arg5, arg6].where((e) => e != null); + } + + return args.map((e) => wrapMatcher(e)).toList(); +} diff --git a/pubspec.yaml b/pubspec.yaml index 2c5ade9..3a21c1b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: matcher -version: 0.11.4+5 +version: 0.11.4+6 author: Dart Team description: Support for specifying test expectations homepage: https://github.com/dart-lang/matcher