Add test for circular refs in deepEquals

Closes GH-207.
v0.7.4-release
Ryan Dahl 2011-03-30 10:18:12 -07:00
parent e35b2d9617
commit 6394ba28c8
1 changed files with 20 additions and 0 deletions

View File

@ -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);