| Index: pkg/matcher/lib/src/core_matchers.dart
|
| diff --git a/pkg/matcher/lib/src/core_matchers.dart b/pkg/matcher/lib/src/core_matchers.dart
|
| index c3c996d908f27b76033061e179bd73530abe8e45..64a7a8b131df1d63d7395e35b7a631d081b1d3db 100644
|
| --- a/pkg/matcher/lib/src/core_matchers.dart
|
| +++ b/pkg/matcher/lib/src/core_matchers.dart
|
| @@ -9,23 +9,32 @@ import 'interfaces.dart';
|
| import 'util.dart';
|
|
|
| /// Returns a matcher that matches empty strings, maps or iterables
|
| -/// (including collections).
|
| +/// (including collections) using the isEmpty property.
|
| const Matcher isEmpty = const _Empty();
|
|
|
| class _Empty extends Matcher {
|
| const _Empty();
|
| bool matches(item, Map matchState) {
|
| - if (item is Map || item is Iterable) {
|
| - return item.isEmpty;
|
| - } else if (item is String) {
|
| - return item.length == 0;
|
| - } else {
|
| - return false;
|
| - }
|
| + return (item is Map || item is Iterable || item is String) && item.isEmpty;
|
| }
|
| Description describe(Description description) => description.add('empty');
|
| }
|
|
|
| +/// Returns a matcher that matches non-empty strings, maps or iterables
|
| +/// (including collections) using the isNotEmpty property.
|
| +const Matcher isNotEmpty = const _NotEmpty();
|
| +
|
| +class _NotEmpty extends Matcher {
|
| + const _NotEmpty();
|
| +
|
| + bool matches(item, Map matchState) {
|
| + return (item is Map || item is Iterable || item is String) &&
|
| + item.isNotEmpty;
|
| + }
|
| +
|
| + Description describe(Description description) => description.add('non-empty');
|
| +}
|
| +
|
| /// A matcher that matches any null value.
|
| const Matcher isNull = const _IsNull();
|
|
|
|
|