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

Unified Diff: pkg/expect/lib/expect.dart

Issue 15745024: Fix bug in Expect package's string compare. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/expect/lib/expect.dart
diff --git a/pkg/expect/lib/expect.dart b/pkg/expect/lib/expect.dart
index 5af15f067fa60a73ea2c4d58a71a8d3b35597b73..25c97d98f3b17f246902d9d88675f908b06770f4 100644
--- a/pkg/expect/lib/expect.dart
+++ b/pkg/expect/lib/expect.dart
@@ -29,6 +29,7 @@ class Expect {
* Control characters may be encoded as "\xhh" codes.
*/
static String _truncateString(String string, int start, int end, int length) {
+ print("$string: $start: $end: $length");
kasperl 2013/05/31 08:14:22 Did you really mean to submit this with the printi
kasperl 2013/05/31 08:28:30 Remove printing.
if (end - start > length) {
end = start + length;
} else if (end - start < length) {
@@ -68,6 +69,7 @@ class Expect {
* only a slice containing the first difference will be shown.
kasperl 2013/05/31 08:28:30 Remove one space after slice.
*/
static String _stringDifference(String expected, String actual) {
+ print("digg: $expected, $actual");
kasperl 2013/05/31 08:28:30 Remove printing.
if (expected.length < 20 && actual.length < 20) return null;
for (int i = 0; i < expected.length && i < actual.length; i++) {
if (expected.codeUnitAt(i) != actual.codeUnitAt(i)) {
@@ -75,6 +77,7 @@ class Expect {
i++;
while (i < expected.length && i < actual.length) {
if (expected.codeUnitAt(i) == actual.codeUnitAt(i)) break;
+ i++;
}
int end = i;
var truncExpected = _truncateString(expected, start, end, 20);
@@ -92,7 +95,6 @@ class Expect {
static void equals(var expected, var actual, [String reason = null]) {
if (expected == actual) return;
String msg = _getMessage(reason);
- stringSpecialCase:
if (expected is String && actual is String) {
String stringDifference = _stringDifference(expected, actual);
if (stringDifference != null) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698