New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comparing object with null prototype and objects derived from Object #729
Comments
The Closing this. |
Thank you for clarifying the first test. However I still have doubts about the second test. If their constructor is null then shouldn't only the two objects properties be considered for equality? I added the following test to Jasmine specs and it fails on master with the same error. it("does something with null prototype objects", function() {
var objA = Object.create(null),
objB = Object.create(null);
objA.name = 'Test';
objB.name = 'Test';
expect(j$.matchersUtil.equals(objA, objB)).toBe(true);
}); It fails with the following error message:
Even if the test should not pass shouldn't it actually run by using |
Hmm, yeah, that part sounds like a bug. We'll have to take a look. |
If you have an idea on how to fix this, I'd be happy to review a pull request. |
Should the following test pass? Currently it fails but IMHO I think it should pass. The reason is both the objects have the same keys. However
objA
is lacking ahasOwnProperty
method which is why I think the test fails. However shouldn't that throw an exception?How about two objects with null prototypes? The second test should pass right? It's complaining that the object doesn't have
hasOwnProperty
method which I expected for the first test also. I'm guessing usingObject.hasOwnProperty.call(obj, property)
should do the trick to make the second test work and pass. However should the first test pass or fail? I'm new to Javascript so I wasn't sure but I'd be happy to work on a PR if required. 😄The test fails with the following failure message:
EDIT 1: Added the output of a test run.
EDIT 2: Added one more test case for both objects with null prototype
The text was updated successfully, but these errors were encountered: