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

Unified Diff: test/mjsunit/mjsunit.js

Issue 18096: Experimental: merge from bleeding_edge. Merge up to and including... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/toiger/
Patch Set: Created 11 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
« no previous file with comments | « test/mjsunit/mirror-string.js ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/mjsunit.js
===================================================================
--- test/mjsunit/mjsunit.js (revision 1085)
+++ test/mjsunit/mjsunit.js (working copy)
@@ -51,8 +51,32 @@
}
+function deepEquals(a, b) {
+ if (a == b) return true;
+ if ((typeof a) !== 'object' || (typeof b) !== 'object' ||
+ (a === null) || (b === null))
+ return false;
+ if (a.constructor === Array) {
+ if (b.constructor !== Array)
+ return false;
+ if (a.length != b.length)
+ return false;
+ for (var i = 0; i < a.length; i++) {
+ if (i in a) {
+ if (!(i in b) || !(deepEquals(a[i], b[i])))
+ return false;
+ } else if (i in b) {
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
+}
+
+
function assertEquals(expected, found, name_opt) {
- if (expected != found) {
+ if (!deepEquals(found, expected)) {
fail(expected, found, name_opt);
}
}
« no previous file with comments | « test/mjsunit/mirror-string.js ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698