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

Unified Diff: pkg/unittest/lib/src/string_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/operator_matchers.dart ('k') | pkg/unittest/lib/unittest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/unittest/lib/src/string_matchers.dart
===================================================================
--- pkg/unittest/lib/src/string_matchers.dart (revision 24041)
+++ pkg/unittest/lib/src/string_matchers.dart (working copy)
@@ -18,7 +18,7 @@
_matchValue = _value.toLowerCase();
}
- bool matches(item, MatchState mismatchState) =>
+ bool matches(item, Map matchState) =>
item is String && _matchValue == item.toLowerCase();
Description describe(Description description) =>
@@ -44,17 +44,18 @@
_matchValue = collapseWhitespace(_value);
}
- bool matches(item, MatchState matchState) =>
+ bool matches(item, Map matchState) =>
item is String && _matchValue == collapseWhitespace(item);
Description describe(Description description) =>
description.addDescriptionOf(_matchValue).add(' ignoring whitespace');
Description describeMismatch(item, Description mismatchDescription,
- MatchState matchState, bool verbose) {
+ Map matchState, bool verbose) {
if (item is String) {
- return mismatchDescription.add('was ').
- addDescriptionOf(collapseWhitespace(item));
+ return mismatchDescription.add('is ').
+ addDescriptionOf(collapseWhitespace(item)).
+ add(' with whitespace compressed');
} else {
return super.describeMismatch(item, mismatchDescription,
matchState, verbose);
@@ -96,7 +97,7 @@
const _StringStartsWith(this._prefix);
- bool matches(item, MatchState matchState) =>
+ bool matches(item, Map matchState) =>
item is String && item.startsWith(_prefix);
Description describe(Description description) =>
@@ -115,7 +116,7 @@
const _StringEndsWith(this._suffix);
- bool matches(item, MatchState matchState) =>
+ bool matches(item, Map matchState) =>
item is String && item.endsWith(_suffix);
Description describe(Description description) =>
@@ -139,7 +140,7 @@
const _StringContainsInOrder(this._substrings);
- bool matches(item, MatchState matchState) {
+ bool matches(item, Map matchState) {
if (!(item is String)) {
return false;
}
@@ -178,7 +179,7 @@
}
}
- bool matches(item, MatchState matchState) =>
+ bool matches(item, Map matchState) =>
item is String ? _regexp.hasMatch(item) : false;
Description describe(Description description) =>
@@ -190,7 +191,7 @@
abstract class _StringMatcher extends BaseMatcher {
const _StringMatcher();
Description describeMismatch(item, Description mismatchDescription,
- MatchState matchState, bool verbose) {
+ Map matchState, bool verbose) {
if (!(item is String)) {
return mismatchDescription.
addDescriptionOf(item).
« no previous file with comments | « pkg/unittest/lib/src/operator_matchers.dart ('k') | pkg/unittest/lib/unittest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698