-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
assert: Add support for Map and Set in deepEqual #12142
Commits on Mar 31, 2017
-
assert: Add support for Map and Set in deepEqual
assert.deepEqual and assert.deepStrictEqual currently return true for any pair of Maps and Sets regardless of content. This patch adds support in deepEqual and deepStrictEqual to verify the contents of Maps and Sets. Unfortunately because there's no way to pairwise fetch set values or map values which are equivalent but not reference-equal, this change currently only supports reference equality checking in set values and map key values. Equivalence checking could be done, but it would be an O(n^2) operation, and worse, it would get slower exponentially if maps and sets were nested. Note that this change breaks compatibility with previous versions of deepEqual and deepStrictEqual if consumers were depending on all maps and sets to be seen as equivalent. The old behaviour was never documented, but nevertheless there are certainly some tests out there which depend on it. Support has stalled because the assert API was frozen, but was recently unfrozen in CTC#63 Fixes: nodejs#2309 Refs: tape-testing/tape#342 Refs: nodejs#2315 Refs: nodejs/CTC#63
Configuration menu - View commit details
-
Copy full SHA for 561561a - Browse repository at this point
Copy the full SHA 561561aView commit details -
assert: Use isSet and isMap from process.binding
Updated PR based on comments Ref: nodejs#12142
Configuration menu - View commit details
-
Copy full SHA for f051840 - Browse repository at this point
Copy the full SHA f051840View commit details -
assert: Added deeper equality checking for Map,Set
This change updates the checks for deep equality checking on Map and Set to check all set values / all map keys to see if any of them match the expected result. This change is much slower, but based on the conversation in the pull request its probably the right approach. Ref: nodejs#12142
Configuration menu - View commit details
-
Copy full SHA for 1d6cda6 - Browse repository at this point
Copy the full SHA 1d6cda6View commit details -
Configuration menu - View commit details
-
Copy full SHA for 800ae46 - Browse repository at this point
Copy the full SHA 800ae46View commit details -
Configuration menu - View commit details
-
Copy full SHA for 031f6f3 - Browse repository at this point
Copy the full SHA 031f6f3View commit details -
assert: var -> const and added tests
Cleaned up as per comments in issue Ref: nodejs#6416
Configuration menu - View commit details
-
Copy full SHA for d6baaee - Browse repository at this point
Copy the full SHA d6baaeeView commit details -
assert: restrict O(n^2) search
Based on comments in the PR, this change restricts an O(n^2) to only happen when your set contains object-like objects, your map contains object-like keys or you're not in strict mode. ref: nodejs#12142 (review)
Configuration menu - View commit details
-
Copy full SHA for 8fb6ebf - Browse repository at this point
Copy the full SHA 8fb6ebfView commit details
Commits on Apr 1, 2017
-
Configuration menu - View commit details
-
Copy full SHA for acef701 - Browse repository at this point
Copy the full SHA acef701View commit details -
Configuration menu - View commit details
-
Copy full SHA for ee131e8 - Browse repository at this point
Copy the full SHA ee131e8View commit details -
- Added changes: entries in assert API documentation - Refactored setEquiv based on @joyeecheung's comments ref: nodejs#12142
Configuration menu - View commit details
-
Copy full SHA for 7bc29b0 - Browse repository at this point
Copy the full SHA 7bc29b0View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6bdfcaf - Browse repository at this point
Copy the full SHA 6bdfcafView commit details -
Configuration menu - View commit details
-
Copy full SHA for fc5196a - Browse repository at this point
Copy the full SHA fc5196aView commit details -
assert: refactored based on PR
Refactored setEquiv and mapEquiv based on @joyeecheung's stylistic preference to avoid labels.
Configuration menu - View commit details
-
Copy full SHA for 7f9d4d8 - Browse repository at this point
Copy the full SHA 7f9d4d8View commit details