assert: fix loose deepEqual map comparison

Loose map comparison had an logic error. It will now be properly
compared.

PR-URL: https://github.com/nodejs/node/pull/24749
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
This commit is contained in:
Ruben Bridgewater 2018-11-30 10:17:51 +01:00
parent e00639e57f
commit 2eff120f6d
No known key found for this signature in database
GPG Key ID: F07496B3EB3C1762
2 changed files with 9 additions and 3 deletions

View File

@ -416,9 +416,7 @@ function mapMightHaveLoosePrim(a, b, prim, item, memo) {
!innerDeepEqual(item, curB, false, memo)) {
return false;
}
const curA = a.get(altValue);
return curA === undefined && a.has(altValue) ||
innerDeepEqual(item, curA, false, memo);
return !a.has(altValue) && innerDeepEqual(item, curB, false, memo);
}
function setEquiv(a, b, strict, memo) {

View File

@ -394,6 +394,14 @@ assertOnlyDeepEqual(
new Map([[1, {}]]),
new Map([[true, {}]])
);
assertOnlyDeepEqual(
new Map([[undefined, true]]),
new Map([[null, true]])
);
assertNotDeepOrStrict(
new Map([[undefined, true]]),
new Map([[true, true]])
);
// GH-6416. Make sure circular refs don't throw.
{