diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2018-08-23 20:29:57 +0200 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2018-09-05 01:49:22 +0200 |
commit | be5e3964b316da013d02ee743420e5fd9cb50c76 (patch) | |
tree | 674bfe39c4a4411fae83e1df2c4d60305a75680f /test/parallel/test-assert-deep.js | |
parent | 9be15559cc0bfe506d9cdfba4ad0f4beacf5ce17 (diff) | |
download | android-node-v8-be5e3964b316da013d02ee743420e5fd9cb50c76.tar.gz android-node-v8-be5e3964b316da013d02ee743420e5fd9cb50c76.tar.bz2 android-node-v8-be5e3964b316da013d02ee743420e5fd9cb50c76.zip |
assert: fix loose set and map comparison
The fast path did not anticipate different ways to express a loose
equal string value (e.g., 1n == '+0001'). This is now fixed with the
downside that all primitives that could theoretically have equal
entries must go through a full comparison.
Only some strings, symbols, undefined, null and NaN can be detected
in a fast path as those entries have a strictly limited set of
possible equal entries.
PR-URL: https://github.com/nodejs/node/pull/22495
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Diffstat (limited to 'test/parallel/test-assert-deep.js')
-rw-r--r-- | test/parallel/test-assert-deep.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/parallel/test-assert-deep.js b/test/parallel/test-assert-deep.js index e857ddf50b..1d8f8fae12 100644 --- a/test/parallel/test-assert-deep.js +++ b/test/parallel/test-assert-deep.js @@ -369,13 +369,13 @@ assertDeepAndStrictEqual( new Map([[null, 3]]) ); assertOnlyDeepEqual( - new Map([[null, undefined]]), - new Map([[undefined, null]]) + new Map([[undefined, null], ['+000', 2n]]), + new Map([[null, undefined], [false, '2']]), ); assertOnlyDeepEqual( - new Set([null, '']), - new Set([undefined, 0]) + new Set([null, '', 1n, 5, 2n, false]), + new Set([undefined, 0, 5n, true, '2', '-000']) ); assertNotDeepOrStrict( new Set(['']), |