Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

comparing the `prototype` property isn't useful #6

Closed
timbertson opened this Issue Apr 15, 2013 · 1 comment

Comments

Projects
None yet
2 participants

I assumed from reading the code that the following test case should pass:

test('differing types', function (t) {
    t.notOk(equal(["a","b"], {0: "a", 1: "b"}));
    t.end();
});

It doesn't (i.e it considers those objects equal), since prototype is generally undefined unless you're comparing constructor functions. I think you mean:

    if (Object.getPrototypeOf(actual) !== Object.getPrototypeOf(expected)) return false;

(or some equivalent where that function is not available)

Owner

substack commented Apr 15, 2013

I didn't write this code, I copied it from node's assert library. The only bugs I'm willing to accept fixes for are where this library deviates from node core but this is how it works in node core too:

$ node
> require('assert').deepEqual(["a","b"], {0: "a", 1: "b"})
undefined

@substack substack closed this Apr 15, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment