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

Unified Diff: tests/lib/convert/streamed_conversion_json_utf8_decode_test.dart

Issue 23056002: Convert HashMap and LinkedHashMap to closed addressing hash tables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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
Index: tests/lib/convert/streamed_conversion_json_utf8_decode_test.dart
diff --git a/tests/lib/convert/streamed_conversion_json_utf8_decode_test.dart b/tests/lib/convert/streamed_conversion_json_utf8_decode_test.dart
index d40a204709021e3a1c44b49484bb1cc6431bf023..1c88d2b800af7cbcf800a5d628a3e12b976aaa83 100644
--- a/tests/lib/convert/streamed_conversion_json_utf8_decode_test.dart
+++ b/tests/lib/convert/streamed_conversion_json_utf8_decode_test.dart
@@ -10,25 +10,25 @@ import '../../async_helper.dart';
final JSON_UTF8 = JSON.fuse(UTF8);
-bool isJsonEqual(o1, o2) {
- if (o1 == o2) return true;
+void expectJsonEquals(o1, o2, [path = "result"]) {
+ if (o1 == o2) return;
if (o1 is List && o2 is List) {
- if (o1.length != o2.length) return false;
+ Expect.equals(o1.length, o2.length, "$path.length");
for (int i = 0; i < o1.length; i++) {
- if (!isJsonEqual(o1[i], o2[i])) return false;
+ expectJsonEquals(o1[i], o2[i], "$path[$i]");
}
- return true;
+ return;
}
if (o1 is Map && o2 is Map) {
- if (o1.length != o2.length) return false;
+ Expect.equals(o1.length, o2.length, "$path.length");
for (var key in o1.keys) {
- Expect.isTrue(key is String);
- if (!o2.containsKey(key)) return false;
- if (!isJsonEqual(o1[key], o2[key])) return false;
+ Expect.isTrue(key is String, "$path:key = $key");
+ Expect.isTrue(o2.containsKey(key), "$path[$key] missing in $o2");
+ expectJsonEquals(o1[key], o2[key], "$path[$key]");
}
- return true;
+ return;
}
- return false;
+ Expect.equals(o1, o2);
}
Stream<Object> createStream(List<List<int>> chunks) {
@@ -61,7 +61,7 @@ Stream<Object> decodeChunked(List<int> bytes, int chunkSize) {
void checkIsJsonEqual(expected, stream) {
asyncStart();
stream.single.then((o) {
- Expect.isTrue(isJsonEqual(expected, o));
+ expectJsonEquals(expected, o);
asyncEnd();
});
}

Powered by Google App Engine
This is Rietveld 408576698