Merge pull request #413 from dart-lang/0.11.x-fix-wrap
Fix _wrapArgs.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2ba4f2b..1b243c2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,8 @@
+##0.11.6+3
+
+* Fix a bug introduced in 0.11.6+2 in which operator matchers broke when taking
+ lists of matchers.
+
##0.11.6+2
* Fix all strong mode warnings.
diff --git a/lib/src/matcher/operator_matchers.dart b/lib/src/matcher/operator_matchers.dart
index 967f3fd..cb4ee33 100644
--- a/lib/src/matcher/operator_matchers.dart
+++ b/lib/src/matcher/operator_matchers.dart
@@ -90,8 +90,23 @@
description.addAll('(', ' or ', ')', _matchers);
}
-List<Matcher> _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<Matcher> _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 35e6b45..825056b 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: unittest
-version: 0.11.6+2
+version: 0.11.6+3
author: Dart Team <misc@dartlang.org>
description: A library for writing dart unit tests.
homepage: https://github.com/dart-lang/old_unittest