Permalink
Browse files

Add test for circular refs in deepEquals

Closes GH-207.
  • Loading branch information...
1 parent e35b2d9 commit 6394ba28c82335cdb6e3578728957cd3eb9f72f1 @ry ry committed Mar 30, 2011
Showing with 20 additions and 0 deletions.
  1. +20 −0 test/simple/test-assert.js
@@ -209,3 +209,23 @@ a.throws(makeBlock(thrower, TypeError), function(err) {
return true;
}
});
+
+
+// GH-207. Make sure deepEqual doesn't loop forever on circular refs
+
+var b = {};
+b.b = b;
+
+var c = {};
+c.b = c;
+
+var gotError = false;
+try {
+ assert.deepEqual(b, c);
+} catch(e) {
+ gotError = true;
+}
+
+console.log('All OK');
+assert.ok(gotError);
+

0 comments on commit 6394ba2

Please sign in to comment.