cleanup(lib): move equals Matcher and CustomMatcher into their own libs (#84)
Reduces lines in lib/src/core_matches.dart by half
No public API change
diff --git a/lib/matcher.dart b/lib/matcher.dart
index b4b9d22..d532926 100644
--- a/lib/matcher.dart
+++ b/lib/matcher.dart
@@ -4,7 +4,9 @@
/// Support for specifying test expectations, such as for unit tests.
export 'src/core_matchers.dart';
+export 'src/custom_matcher.dart';
export 'src/description.dart';
+export 'src/equals_matcher.dart';
export 'src/error_matchers.dart';
export 'src/interfaces.dart';
export 'src/iterable_matchers.dart';
diff --git a/lib/src/core_matchers.dart b/lib/src/core_matchers.dart
index 0efe4e9..6ab3f62 100644
--- a/lib/src/core_matchers.dart
+++ b/lib/src/core_matchers.dart
@@ -2,9 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import 'package:stack_trace/stack_trace.dart';
-
-import 'description.dart';
import 'interfaces.dart';
import 'util.dart';
@@ -97,271 +94,6 @@
description.add('same instance as ').addDescriptionOf(_expected);
}
-/// Returns a matcher that matches if the value is structurally equal to
-/// [expected].
-///
-/// If [expected] is a [Matcher], then it matches using that. Otherwise it tests
-/// for equality using `==` on the expected value.
-///
-/// For [Iterable]s and [Map]s, this will recursively match the elements. To
-/// handle cyclic structures a recursion depth [limit] can be provided. The
-/// default limit is 100. [Set]s will be compared order-independently.
-Matcher equals(expected, [int limit = 100]) => expected is String
- ? new _StringEqualsMatcher(expected)
- : new _DeepMatcher(expected, limit);
-
-typedef _RecursiveMatcher = List<String> Function(
- dynamic, dynamic, String, int);
-
-class _DeepMatcher extends Matcher {
- final _expected;
- final int _limit;
-
- _DeepMatcher(this._expected, [int limit = 1000]) : this._limit = limit;
-
- // Returns a pair (reason, location)
- List<String> _compareIterables(Iterable expected, Object actual,
- _RecursiveMatcher matcher, int depth, String location) {
- if (actual is Iterable) {
- var expectedIterator = expected.iterator;
- var actualIterator = actual.iterator;
- for (var index = 0;; index++) {
- // Advance in lockstep.
- var expectedNext = expectedIterator.moveNext();
- var actualNext = actualIterator.moveNext();
-
- // If we reached the end of both, we succeeded.
- if (!expectedNext && !actualNext) return null;
-
- // Fail if their lengths are different.
- var newLocation = '$location[$index]';
- if (!expectedNext) return ['longer than expected', newLocation];
- if (!actualNext) return ['shorter than expected', newLocation];
-
- // Match the elements.
- var rp = matcher(expectedIterator.current, actualIterator.current,
- newLocation, depth);
- if (rp != null) return rp;
- }
- } else {
- return ['is not Iterable', location];
- }
- }
-
- List<String> _compareSets(Set expected, Object actual,
- _RecursiveMatcher matcher, int depth, String location) {
- if (actual is Iterable) {
- Set other = actual.toSet();
-
- for (var expectedElement in expected) {
- if (other.every((actualElement) =>
- matcher(expectedElement, actualElement, location, depth) != null)) {
- return ['does not contain $expectedElement', location];
- }
- }
-
- if (other.length > expected.length) {
- return ['larger than expected', location];
- } else if (other.length < expected.length) {
- return ['smaller than expected', location];
- } else {
- return null;
- }
- } else {
- return ['is not Iterable', location];
- }
- }
-
- List<String> _recursiveMatch(
- Object expected, Object actual, String location, int depth) {
- // If the expected value is a matcher, try to match it.
- if (expected is Matcher) {
- var matchState = {};
- if (expected.matches(actual, matchState)) return null;
-
- var description = new StringDescription();
- expected.describe(description);
- return ['does not match $description', location];
- } else {
- // Otherwise, test for equality.
- try {
- if (expected == actual) return null;
- } catch (e) {
- // TODO(gram): Add a test for this case.
- return ['== threw "$e"', location];
- }
- }
-
- if (depth > _limit) return ['recursion depth limit exceeded', location];
-
- // If _limit is 1 we can only recurse one level into object.
- if (depth == 0 || _limit > 1) {
- if (expected is Set) {
- return _compareSets(
- expected, actual, _recursiveMatch, depth + 1, location);
- } else if (expected is Iterable) {
- return _compareIterables(
- expected, actual, _recursiveMatch, depth + 1, location);
- } else if (expected is Map) {
- if (actual is! Map) return ['expected a map', location];
- var map = (actual as Map);
- var err =
- (expected.length == map.length) ? '' : 'has different length and ';
- for (var key in expected.keys) {
- if (!map.containsKey(key)) {
- return ["${err}is missing map key '$key'", location];
- }
- }
-
- for (var key in map.keys) {
- if (!expected.containsKey(key)) {
- return ["${err}has extra map key '$key'", location];
- }
- }
-
- for (var key in expected.keys) {
- var rp = _recursiveMatch(
- expected[key], map[key], "$location['$key']", depth + 1);
- if (rp != null) return rp;
- }
-
- return null;
- }
- }
-
- var description = new StringDescription();
-
- // If we have recursed, show the expected value too; if not, expect() will
- // show it for us.
- if (depth > 0) {
- description
- .add('was ')
- .addDescriptionOf(actual)
- .add(' instead of ')
- .addDescriptionOf(expected);
- return [description.toString(), location];
- }
-
- // We're not adding any value to the actual value.
- return ["", location];
- }
-
- String _match(expected, actual, Map matchState) {
- var rp = _recursiveMatch(expected, actual, '', 0);
- if (rp == null) return null;
- String reason;
- if (rp[0].length > 0) {
- if (rp[1].length > 0) {
- reason = "${rp[0]} at location ${rp[1]}";
- } else {
- reason = rp[0];
- }
- } else {
- reason = '';
- }
- // Cache the failure reason in the matchState.
- addStateInfo(matchState, {'reason': reason});
- return reason;
- }
-
- bool matches(item, Map matchState) =>
- _match(_expected, item, matchState) == null;
-
- Description describe(Description description) =>
- description.addDescriptionOf(_expected);
-
- Description describeMismatch(
- item, Description mismatchDescription, Map matchState, bool verbose) {
- var reason = matchState['reason'] ?? '';
- // If we didn't get a good reason, that would normally be a
- // simple 'is <value>' message. We only add that if the mismatch
- // description is non empty (so we are supplementing the mismatch
- // description).
- if (reason.length == 0 && mismatchDescription.length > 0) {
- mismatchDescription.add('is ').addDescriptionOf(item);
- } else {
- mismatchDescription.add(reason);
- }
- return mismatchDescription;
- }
-}
-
-/// A special equality matcher for strings.
-class _StringEqualsMatcher extends Matcher {
- final String _value;
-
- _StringEqualsMatcher(this._value);
-
- bool get showActualValue => true;
-
- bool matches(item, Map matchState) => _value == item;
-
- Description describe(Description description) =>
- description.addDescriptionOf(_value);
-
- Description describeMismatch(
- item, Description mismatchDescription, Map matchState, bool verbose) {
- if (item is! String) {
- return mismatchDescription.addDescriptionOf(item).add('is not a string');
- } else {
- var buff = new StringBuffer();
- buff.write('is different.');
- var escapedItem = escape(item);
- var escapedValue = escape(_value);
- int minLength = escapedItem.length < escapedValue.length
- ? escapedItem.length
- : escapedValue.length;
- var start = 0;
- for (; start < minLength; start++) {
- if (escapedValue.codeUnitAt(start) != escapedItem.codeUnitAt(start)) {
- break;
- }
- }
- if (start == minLength) {
- if (escapedValue.length < escapedItem.length) {
- buff.write(' Both strings start the same, but the actual value also'
- ' has the following trailing characters: ');
- _writeTrailing(buff, escapedItem, escapedValue.length);
- } else {
- buff.write(' Both strings start the same, but the actual value is'
- ' missing the following trailing characters: ');
- _writeTrailing(buff, escapedValue, escapedItem.length);
- }
- } else {
- buff.write('\nExpected: ');
- _writeLeading(buff, escapedValue, start);
- _writeTrailing(buff, escapedValue, start);
- buff.write('\n Actual: ');
- _writeLeading(buff, escapedItem, start);
- _writeTrailing(buff, escapedItem, start);
- buff.write('\n ');
- for (int i = (start > 10 ? 14 : start); i > 0; i--) buff.write(' ');
- buff.write('^\n Differ at offset $start');
- }
-
- return mismatchDescription.add(buff.toString());
- }
- }
-
- static void _writeLeading(StringBuffer buff, String s, int start) {
- if (start > 10) {
- buff.write('... ');
- buff.write(s.substring(start - 10, start));
- } else {
- buff.write(s.substring(0, start));
- }
- }
-
- static void _writeTrailing(StringBuffer buff, String s, int start) {
- if (start + 10 > s.length) {
- buff.write(s.substring(start));
- } else {
- buff.write(s.substring(start, start + 10));
- buff.write(' ...');
- }
- }
-}
-
/// A matcher that matches any value.
const Matcher anything = const _IsAnything();
@@ -594,88 +326,3 @@
Description describe(Description description) =>
description.add(_description);
}
-
-/// A useful utility class for implementing other matchers through inheritance.
-/// Derived classes should call the base constructor with a feature name and
-/// description, and an instance matcher, and should implement the
-/// [featureValueOf] abstract method.
-///
-/// The feature description will typically describe the item and the feature,
-/// while the feature name will just name the feature. For example, we may
-/// have a Widget class where each Widget has a price; we could make a
-/// [CustomMatcher] that can make assertions about prices with:
-///
-/// ```dart
-/// class HasPrice extends CustomMatcher {
-/// HasPrice(matcher) : super("Widget with price that is", "price", matcher);
-/// featureValueOf(actual) => actual.price;
-/// }
-/// ```
-///
-/// and then use this for example like:
-///
-/// ```dart
-/// expect(inventoryItem, new HasPrice(greaterThan(0)));
-/// ```
-class CustomMatcher extends Matcher {
- final String _featureDescription;
- final String _featureName;
- final Matcher _matcher;
-
- CustomMatcher(this._featureDescription, this._featureName, matcher)
- : this._matcher = wrapMatcher(matcher);
-
- /// Override this to extract the interesting feature.
- featureValueOf(actual) => actual;
-
- bool matches(item, Map matchState) {
- try {
- var f = featureValueOf(item);
- if (_matcher.matches(f, matchState)) return true;
- addStateInfo(matchState, {'custom.feature': f});
- } catch (exception, stack) {
- addStateInfo(matchState, {
- 'custom.exception': exception.toString(),
- 'custom.stack': new Chain.forTrace(stack)
- .foldFrames(
- (frame) =>
- frame.package == 'test' ||
- frame.package == 'stream_channel' ||
- frame.package == 'matcher',
- terse: true)
- .toString()
- });
- }
- return false;
- }
-
- Description describe(Description description) =>
- description.add(_featureDescription).add(' ').addDescriptionOf(_matcher);
-
- Description describeMismatch(
- item, Description mismatchDescription, Map matchState, bool verbose) {
- if (matchState['custom.exception'] != null) {
- mismatchDescription
- .add('threw ')
- .addDescriptionOf(matchState['custom.exception'])
- .add('\n')
- .add(matchState['custom.stack'].toString());
- return mismatchDescription;
- }
-
- mismatchDescription
- .add('has ')
- .add(_featureName)
- .add(' with value ')
- .addDescriptionOf(matchState['custom.feature']);
- var innerDescription = new StringDescription();
-
- _matcher.describeMismatch(matchState['custom.feature'], innerDescription,
- matchState['state'], verbose);
-
- if (innerDescription.length > 0) {
- mismatchDescription.add(' which ').add(innerDescription.toString());
- }
- return mismatchDescription;
- }
-}
diff --git a/lib/src/custom_matcher.dart b/lib/src/custom_matcher.dart
new file mode 100644
index 0000000..82b0e01
--- /dev/null
+++ b/lib/src/custom_matcher.dart
@@ -0,0 +1,94 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:stack_trace/stack_trace.dart';
+
+import 'description.dart';
+import 'interfaces.dart';
+import 'util.dart';
+
+/// A useful utility class for implementing other matchers through inheritance.
+/// Derived classes should call the base constructor with a feature name and
+/// description, and an instance matcher, and should implement the
+/// [featureValueOf] abstract method.
+///
+/// The feature description will typically describe the item and the feature,
+/// while the feature name will just name the feature. For example, we may
+/// have a Widget class where each Widget has a price; we could make a
+/// [CustomMatcher] that can make assertions about prices with:
+///
+/// ```dart
+/// class HasPrice extends CustomMatcher {
+/// HasPrice(matcher) : super("Widget with price that is", "price", matcher);
+/// featureValueOf(actual) => actual.price;
+/// }
+/// ```
+///
+/// and then use this for example like:
+///
+/// ```dart
+/// expect(inventoryItem, new HasPrice(greaterThan(0)));
+/// ```
+class CustomMatcher extends Matcher {
+ final String _featureDescription;
+ final String _featureName;
+ final Matcher _matcher;
+
+ CustomMatcher(this._featureDescription, this._featureName, matcher)
+ : this._matcher = wrapMatcher(matcher);
+
+ /// Override this to extract the interesting feature.
+ featureValueOf(actual) => actual;
+
+ bool matches(item, Map matchState) {
+ try {
+ var f = featureValueOf(item);
+ if (_matcher.matches(f, matchState)) return true;
+ addStateInfo(matchState, {'custom.feature': f});
+ } catch (exception, stack) {
+ addStateInfo(matchState, {
+ 'custom.exception': exception.toString(),
+ 'custom.stack': new Chain.forTrace(stack)
+ .foldFrames(
+ (frame) =>
+ frame.package == 'test' ||
+ frame.package == 'stream_channel' ||
+ frame.package == 'matcher',
+ terse: true)
+ .toString()
+ });
+ }
+ return false;
+ }
+
+ Description describe(Description description) =>
+ description.add(_featureDescription).add(' ').addDescriptionOf(_matcher);
+
+ Description describeMismatch(
+ item, Description mismatchDescription, Map matchState, bool verbose) {
+ if (matchState['custom.exception'] != null) {
+ mismatchDescription
+ .add('threw ')
+ .addDescriptionOf(matchState['custom.exception'])
+ .add('\n')
+ .add(matchState['custom.stack'].toString());
+ return mismatchDescription;
+ }
+
+ mismatchDescription
+ .add('has ')
+ .add(_featureName)
+ .add(' with value ')
+ .addDescriptionOf(matchState['custom.feature']);
+ var innerDescription = new StringDescription();
+
+ _matcher.describeMismatch(matchState['custom.feature'], innerDescription,
+ matchState['state'], verbose);
+
+ if (innerDescription.length > 0) {
+ mismatchDescription.add(' which ').add(innerDescription.toString());
+ }
+ return mismatchDescription;
+ }
+}
diff --git a/lib/src/equals_matcher.dart b/lib/src/equals_matcher.dart
new file mode 100644
index 0000000..255141b
--- /dev/null
+++ b/lib/src/equals_matcher.dart
@@ -0,0 +1,272 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'description.dart';
+import 'interfaces.dart';
+import 'util.dart';
+
+/// Returns a matcher that matches if the value is structurally equal to
+/// [expected].
+///
+/// If [expected] is a [Matcher], then it matches using that. Otherwise it tests
+/// for equality using `==` on the expected value.
+///
+/// For [Iterable]s and [Map]s, this will recursively match the elements. To
+/// handle cyclic structures a recursion depth [limit] can be provided. The
+/// default limit is 100. [Set]s will be compared order-independently.
+Matcher equals(expected, [int limit = 100]) => expected is String
+ ? new _StringEqualsMatcher(expected)
+ : new _DeepMatcher(expected, limit);
+
+typedef _RecursiveMatcher = List<String> Function(
+ dynamic, dynamic, String, int);
+
+/// A special equality matcher for strings.
+class _StringEqualsMatcher extends Matcher {
+ final String _value;
+
+ _StringEqualsMatcher(this._value);
+
+ bool get showActualValue => true;
+
+ bool matches(item, Map matchState) => _value == item;
+
+ Description describe(Description description) =>
+ description.addDescriptionOf(_value);
+
+ Description describeMismatch(
+ item, Description mismatchDescription, Map matchState, bool verbose) {
+ if (item is! String) {
+ return mismatchDescription.addDescriptionOf(item).add('is not a string');
+ } else {
+ var buff = new StringBuffer();
+ buff.write('is different.');
+ var escapedItem = escape(item);
+ var escapedValue = escape(_value);
+ int minLength = escapedItem.length < escapedValue.length
+ ? escapedItem.length
+ : escapedValue.length;
+ var start = 0;
+ for (; start < minLength; start++) {
+ if (escapedValue.codeUnitAt(start) != escapedItem.codeUnitAt(start)) {
+ break;
+ }
+ }
+ if (start == minLength) {
+ if (escapedValue.length < escapedItem.length) {
+ buff.write(' Both strings start the same, but the actual value also'
+ ' has the following trailing characters: ');
+ _writeTrailing(buff, escapedItem, escapedValue.length);
+ } else {
+ buff.write(' Both strings start the same, but the actual value is'
+ ' missing the following trailing characters: ');
+ _writeTrailing(buff, escapedValue, escapedItem.length);
+ }
+ } else {
+ buff.write('\nExpected: ');
+ _writeLeading(buff, escapedValue, start);
+ _writeTrailing(buff, escapedValue, start);
+ buff.write('\n Actual: ');
+ _writeLeading(buff, escapedItem, start);
+ _writeTrailing(buff, escapedItem, start);
+ buff.write('\n ');
+ for (int i = (start > 10 ? 14 : start); i > 0; i--) buff.write(' ');
+ buff.write('^\n Differ at offset $start');
+ }
+
+ return mismatchDescription.add(buff.toString());
+ }
+ }
+
+ static void _writeLeading(StringBuffer buff, String s, int start) {
+ if (start > 10) {
+ buff.write('... ');
+ buff.write(s.substring(start - 10, start));
+ } else {
+ buff.write(s.substring(0, start));
+ }
+ }
+
+ static void _writeTrailing(StringBuffer buff, String s, int start) {
+ if (start + 10 > s.length) {
+ buff.write(s.substring(start));
+ } else {
+ buff.write(s.substring(start, start + 10));
+ buff.write(' ...');
+ }
+ }
+}
+
+class _DeepMatcher extends Matcher {
+ final _expected;
+ final int _limit;
+
+ _DeepMatcher(this._expected, [int limit = 1000]) : this._limit = limit;
+
+ // Returns a pair (reason, location)
+ List<String> _compareIterables(Iterable expected, Object actual,
+ _RecursiveMatcher matcher, int depth, String location) {
+ if (actual is Iterable) {
+ var expectedIterator = expected.iterator;
+ var actualIterator = actual.iterator;
+ for (var index = 0;; index++) {
+ // Advance in lockstep.
+ var expectedNext = expectedIterator.moveNext();
+ var actualNext = actualIterator.moveNext();
+
+ // If we reached the end of both, we succeeded.
+ if (!expectedNext && !actualNext) return null;
+
+ // Fail if their lengths are different.
+ var newLocation = '$location[$index]';
+ if (!expectedNext) return ['longer than expected', newLocation];
+ if (!actualNext) return ['shorter than expected', newLocation];
+
+ // Match the elements.
+ var rp = matcher(expectedIterator.current, actualIterator.current,
+ newLocation, depth);
+ if (rp != null) return rp;
+ }
+ } else {
+ return ['is not Iterable', location];
+ }
+ }
+
+ List<String> _compareSets(Set expected, Object actual,
+ _RecursiveMatcher matcher, int depth, String location) {
+ if (actual is Iterable) {
+ Set other = actual.toSet();
+
+ for (var expectedElement in expected) {
+ if (other.every((actualElement) =>
+ matcher(expectedElement, actualElement, location, depth) != null)) {
+ return ['does not contain $expectedElement', location];
+ }
+ }
+
+ if (other.length > expected.length) {
+ return ['larger than expected', location];
+ } else if (other.length < expected.length) {
+ return ['smaller than expected', location];
+ } else {
+ return null;
+ }
+ } else {
+ return ['is not Iterable', location];
+ }
+ }
+
+ List<String> _recursiveMatch(
+ Object expected, Object actual, String location, int depth) {
+ // If the expected value is a matcher, try to match it.
+ if (expected is Matcher) {
+ var matchState = {};
+ if (expected.matches(actual, matchState)) return null;
+
+ var description = new StringDescription();
+ expected.describe(description);
+ return ['does not match $description', location];
+ } else {
+ // Otherwise, test for equality.
+ try {
+ if (expected == actual) return null;
+ } catch (e) {
+ // TODO(gram): Add a test for this case.
+ return ['== threw "$e"', location];
+ }
+ }
+
+ if (depth > _limit) return ['recursion depth limit exceeded', location];
+
+ // If _limit is 1 we can only recurse one level into object.
+ if (depth == 0 || _limit > 1) {
+ if (expected is Set) {
+ return _compareSets(
+ expected, actual, _recursiveMatch, depth + 1, location);
+ } else if (expected is Iterable) {
+ return _compareIterables(
+ expected, actual, _recursiveMatch, depth + 1, location);
+ } else if (expected is Map) {
+ if (actual is! Map) return ['expected a map', location];
+ var map = (actual as Map);
+ var err =
+ (expected.length == map.length) ? '' : 'has different length and ';
+ for (var key in expected.keys) {
+ if (!map.containsKey(key)) {
+ return ["${err}is missing map key '$key'", location];
+ }
+ }
+
+ for (var key in map.keys) {
+ if (!expected.containsKey(key)) {
+ return ["${err}has extra map key '$key'", location];
+ }
+ }
+
+ for (var key in expected.keys) {
+ var rp = _recursiveMatch(
+ expected[key], map[key], "$location['$key']", depth + 1);
+ if (rp != null) return rp;
+ }
+
+ return null;
+ }
+ }
+
+ var description = new StringDescription();
+
+ // If we have recursed, show the expected value too; if not, expect() will
+ // show it for us.
+ if (depth > 0) {
+ description
+ .add('was ')
+ .addDescriptionOf(actual)
+ .add(' instead of ')
+ .addDescriptionOf(expected);
+ return [description.toString(), location];
+ }
+
+ // We're not adding any value to the actual value.
+ return ["", location];
+ }
+
+ String _match(expected, actual, Map matchState) {
+ var rp = _recursiveMatch(expected, actual, '', 0);
+ if (rp == null) return null;
+ String reason;
+ if (rp[0].length > 0) {
+ if (rp[1].length > 0) {
+ reason = "${rp[0]} at location ${rp[1]}";
+ } else {
+ reason = rp[0];
+ }
+ } else {
+ reason = '';
+ }
+ // Cache the failure reason in the matchState.
+ addStateInfo(matchState, {'reason': reason});
+ return reason;
+ }
+
+ bool matches(item, Map matchState) =>
+ _match(_expected, item, matchState) == null;
+
+ Description describe(Description description) =>
+ description.addDescriptionOf(_expected);
+
+ Description describeMismatch(
+ item, Description mismatchDescription, Map matchState, bool verbose) {
+ var reason = matchState['reason'] ?? '';
+ // If we didn't get a good reason, that would normally be a
+ // simple 'is <value>' message. We only add that if the mismatch
+ // description is non empty (so we are supplementing the mismatch
+ // description).
+ if (reason.length == 0 && mismatchDescription.length > 0) {
+ mismatchDescription.add('is ').addDescriptionOf(item);
+ } else {
+ mismatchDescription.add(reason);
+ }
+ return mismatchDescription;
+ }
+}
diff --git a/lib/src/iterable_matchers.dart b/lib/src/iterable_matchers.dart
index a4a122c..8d57e5c 100644
--- a/lib/src/iterable_matchers.dart
+++ b/lib/src/iterable_matchers.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import 'core_matchers.dart';
+import 'equals_matcher.dart';
import 'description.dart';
import 'interfaces.dart';
import 'util.dart';
diff --git a/lib/src/util.dart b/lib/src/util.dart
index 7e7ff05..38e6b73 100644
--- a/lib/src/util.dart
+++ b/lib/src/util.dart
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'core_matchers.dart';
+import 'equals_matcher.dart';
import 'interfaces.dart';
typedef bool _Predicate<T>(T value);
diff --git a/pubspec.yaml b/pubspec.yaml
index f08b2a3..268d102 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: matcher
-version: 0.12.2+1
+version: 0.12.3-dev
author: Dart Team <misc@dartlang.org>
description: Support for specifying test expectations
homepage: https://github.com/dart-lang/matcher