Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(438)

Unified Diff: pkg/unittest/lib/src/operator_matchers.dart

Issue 16408019: Improved error messages from unittest. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/unittest/lib/src/numeric_matchers.dart ('k') | pkg/unittest/lib/src/string_matchers.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/unittest/lib/src/operator_matchers.dart
===================================================================
--- pkg/unittest/lib/src/operator_matchers.dart (revision 24041)
+++ pkg/unittest/lib/src/operator_matchers.dart (working copy)
@@ -14,7 +14,7 @@
const _IsNot(Matcher this._matcher);
- bool matches(item, MatchState matchState) =>
+ bool matches(item, Map matchState) =>
!_matcher.matches(item, matchState);
Description describe(Description description) =>
@@ -78,13 +78,10 @@
const _AllOf(this._matchers);
- bool matches(item, MatchState matchState) {
+ bool matches(item, Map matchState) {
for (var matcher in _matchers) {
if (!matcher.matches(item, matchState)) {
- matchState.state = {
- 'matcher': matcher,
- 'state': matchState.state
- };
+ addStateInfo(matchState, {'matcher': matcher});
return false;
}
}
@@ -92,11 +89,10 @@
}
Description describeMismatch(item, Description mismatchDescription,
- MatchState matchState, bool verbose) {
- var matcher = matchState.state['matcher'];
+ Map matchState, bool verbose) {
+ var matcher = matchState['matcher'];
matcher.describeMismatch(item, mismatchDescription,
- matchState.state['state'], verbose);
- mismatchDescription.add(" (wasn't ").addDescriptionOf(matcher).add(')');
+ matchState['state'], verbose);
return mismatchDescription;
}
@@ -166,7 +162,7 @@
const _AnyOf(this._matchers);
- bool matches(item, MatchState matchState) {
+ bool matches(item, Map matchState) {
for (var matcher in _matchers) {
if (matcher.matches(item, matchState)) {
return true;
« no previous file with comments | « pkg/unittest/lib/src/numeric_matchers.dart ('k') | pkg/unittest/lib/src/string_matchers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698