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

Unified Diff: dart/tools/testing/dart/utils.dart

Issue 122443003: Added PkgBuildTestSuite (aka 'pkgbuild') (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 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: dart/tools/testing/dart/utils.dart
diff --git a/dart/tools/testing/dart/utils.dart b/dart/tools/testing/dart/utils.dart
index eacba54e39ec566a843012384eec7bf692a18ab7..b4455fa1a6042d7bc17e51a95b8d8c9eb934cc42 100644
--- a/dart/tools/testing/dart/utils.dart
+++ b/dart/tools/testing/dart/utils.dart
@@ -233,6 +233,19 @@ class HashCodeBuilder {
_value = ((_value * 31) ^ object.hashCode) & 0x3FFFFFFF;
}
+ void addJson(Object object) {
+ if (object == null || object is num || object is String) {
+ add(object);
+ } else if (object is List) {
+ object.forEach(addJson);
+ } else if (object is Map) {
+ object.forEach((k, v) { addJson(k); addJson(value); });
+ } else {
+ throw new Exception("Can't build hashcode for non json-like object "
+ "(${object.runtimeType})");
+ }
+ }
+
int get value => _value;
}
« dart/tools/testing/dart/test_suite.dart ('K') | « dart/tools/testing/dart/test_suite.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698