jquery/qunit — pull request #170 by DomenicDenicola (2011-11-01 22:56:07+00:00)
Title: Allow objects with no prototype to be tested against object literals.

I often use objects created with `Object.create(null)` as dictionaries, since then they don't have pre-filled dictionary entries for e.g. `constructor`, `hasOwnProperty`, `isPrototypeOf`, etc. However, in my tests, it is quite useful to test the dictionaries I create against object literals (which have `Object.prototype` as their prototype).

This patch makes an exemption to the rule that two objects must have the same constructor, for the case where one has `null` prototype and the other `Object.prototype` as its prototype.

Sample usage:

function returnsADict() {
var dict = Object.create(null);

dict.luke = "jedi";
dict.vader = "sith";

return dict;
}

// in my test
deepEqual(returnsADict(), { luke: "jedi", vader: "sith" });

Without this patch the `deepEqual` fails; with it, it succeeds.