| Index: dart/tools/testing/dart/utils.dart
|
| diff --git a/dart/tools/testing/dart/utils.dart b/dart/tools/testing/dart/utils.dart
|
| index 59c5021b171fe9c290309a2ec59ba93a8ca4d478..eacba54e39ec566a843012384eec7bf692a18ab7 100644
|
| --- a/dart/tools/testing/dart/utils.dart
|
| +++ b/dart/tools/testing/dart/utils.dart
|
| @@ -236,6 +236,36 @@ class HashCodeBuilder {
|
| int get value => _value;
|
| }
|
|
|
| +bool deepJsonCompare(Object a, Object b) {
|
| + if (a == null || a is num || a is String) {
|
| + return a == b;
|
| + } else if (a is List) {
|
| + if (b is List) {
|
| + if (a.length != b.length) return false;
|
| +
|
| + for (int i = 0; i < a.length; i++) {
|
| + if (!deepJsonCompare(a[i], b[i])) return false;
|
| + }
|
| + return true;
|
| + }
|
| + return false;
|
| + } else if (a is Map) {
|
| + if (b is Map) {
|
| + if (a.length != b.length) return false;
|
| +
|
| + for (var key in a.keys) {
|
| + if (!b.containsKey(key)) return false;
|
| + if (!deepJsonCompare(a[key], b[key])) return false;
|
| + }
|
| + return true;
|
| + }
|
| + return false;
|
| + } else {
|
| + throw new Exception("Can't compare two non json-like objects "
|
| + "(a: ${a.runtimeType}, b: ${b.runtimeType})");
|
| + }
|
| +}
|
| +
|
| class UniqueObject {
|
| static int _nextId = 1;
|
| final int _hashCode;
|
|
|