assert: don't compare object prototype
property
All own enumerable properties are compared already. Comparing `prototype` property specifically can cause weird behaviour. PR-URL: https://github.com/iojs/io.js/pull/636 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
parent
8d1179952a
commit
e7573f9111
@ -186,8 +186,6 @@ function isArguments(object) {
|
|||||||
function objEquiv(a, b) {
|
function objEquiv(a, b) {
|
||||||
if (a === null || a === undefined || b === null || b === undefined)
|
if (a === null || a === undefined || b === null || b === undefined)
|
||||||
return false;
|
return false;
|
||||||
// an identical 'prototype' property.
|
|
||||||
if (a.prototype !== b.prototype) return false;
|
|
||||||
// if one is a primitive, the other must be same
|
// if one is a primitive, the other must be same
|
||||||
if (util.isPrimitive(a) || util.isPrimitive(b))
|
if (util.isPrimitive(a) || util.isPrimitive(b))
|
||||||
return a === b;
|
return a === b;
|
||||||
|
@ -130,7 +130,7 @@ assert.doesNotThrow(makeBlock(a.deepEqual, nb1, nb2));
|
|||||||
|
|
||||||
nameBuilder2.prototype = Object;
|
nameBuilder2.prototype = Object;
|
||||||
nb2 = new nameBuilder2('Ryan', 'Dahl');
|
nb2 = new nameBuilder2('Ryan', 'Dahl');
|
||||||
assert.throws(makeBlock(a.deepEqual, nb1, nb2), a.AssertionError);
|
assert.doesNotThrow(makeBlock(a.deepEqual, nb1, nb2));
|
||||||
|
|
||||||
// primitives and object
|
// primitives and object
|
||||||
assert.throws(makeBlock(a.deepEqual, null, {}), a.AssertionError);
|
assert.throws(makeBlock(a.deepEqual, null, {}), a.AssertionError);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user