Skip to content
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

Document assert_object_equals #10262

Closed
foolip opened this issue Mar 31, 2018 · 1 comment
Closed

Document assert_object_equals #10262

foolip opened this issue Mar 31, 2018 · 1 comment
Labels

Comments

@foolip
Copy link
Member

foolip commented Mar 31, 2018

I saw it used in https://chromium-review.googlesource.com/c/chromium/src/+/978128 and wasn't sure exactly what it does and didn't find it in http://web-platform-tests.org/writing-tests/testharness-api.html.

Per #2033 some think it should be removed instead, but if it's not deleted it'd be useful to know about the limitations.

@foolip foolip added the docs label Mar 31, 2018
@foolip
Copy link
Member Author

foolip commented Mar 31, 2018

Implementation at https://github.com/w3c/web-platform-tests/blob/355c2d77c7ec01ee18fd9c5917cc845a558551e8/resources/testharness.js#L964.

AFAICT, what it does is to check that all enumerable properties on one object are own properties on the other with the same values, recursing into other objects and dealing with cycles.

Because it isn't checked that the inputs are really objects, things like assert_object_equals({}, null), assert_object_equals(1, 2) and assert_object_equals({}, []) all pass because for (x in null) {} and similar doesn't throw an exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant