From 6394ba28c82335cdb6e3578728957cd3eb9f72f1 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Wed, 30 Mar 2011 10:18:12 -0700 Subject: [PATCH] Add test for circular refs in deepEquals Closes GH-207. --- test/simple/test-assert.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/simple/test-assert.js b/test/simple/test-assert.js index 7ccaee8..f15072f 100644 --- a/test/simple/test-assert.js +++ b/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); + -- 2.7.4