Skip to content

Commit

Permalink
assert: verify issue 53423
Browse files Browse the repository at this point in the history
fix: correct comparison

Update test/parallel/test-assert-deep.js

Co-authored-by: Chris Harvey <[email protected]>
  • Loading branch information
lemire and chharvey committed Jun 13, 2024
1 parent 17a7663 commit 40a807e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/internal/util/comparisons.js
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ function setEquiv(a, b, strict, memo) {
for (const val of b) {
// Primitive values have already been handled above.
if (typeof val === 'object' && val !== null) {
if (!setHasEqualElement(set, val, strict, memo))
if (!a.has(val) && !setHasEqualElement(set, val, strict, memo))
return false;
} else if (!strict &&
!a.has(val) &&
Expand Down
6 changes: 5 additions & 1 deletion test/parallel/test-assert-deep.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,11 @@ assertOnlyDeepEqual(
new Map([[undefined, null], ['+000', 2n]]),
new Map([[null, undefined], [false, '2']]),
);

const xarray = ['x'];
assertDeepAndStrictEqual(
new Set([xarray, ['y']]),
new Set([xarray, ['y']])
);
assertOnlyDeepEqual(
new Set([null, '', 1n, 5, 2n, false]),
new Set([undefined, 0, 5n, true, '2', '-000'])
Expand Down

0 comments on commit 40a807e

Please sign in to comment.