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

assertEquals: no warnings or errors when used with WeakMap/WeakSet/WeakRef #949

Closed
mfulton26 opened this issue Jun 3, 2021 · 2 comments
Closed
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@mfulton26
Copy link
Contributor

none of the following throw an AssertionError:

assertEquals(new WeakMap([[a, 1]]), new WeakMap([[b, 2]]));
assertEquals(new WeakSet([a]), new WeakSet([b]));
assertEquals(new WeakRef(a), new WeakRef(b));

while each of the following do:

assertEquals(new WeakMap([[a, 1]]).get(a), new WeakMap([[b, 2]]).get(a));
assertEquals(new WeakSet([a]).has(a), new WeakSet([b]).has(a));
assertEquals(new WeakRef(a).deref(), new WeakRef(b).deref());

these seem like special cases where a deep equality assertion cannot be done; should some sort of warning and/or error be thrown instead of incorrectly asserting deep equality?

@kitsonk kitsonk transferred this issue from denoland/deno Jun 3, 2021
@kitsonk kitsonk added the bug Something isn't working label Jun 3, 2021
@kitsonk
Copy link
Contributor

kitsonk commented Jun 3, 2021

These should simply throw that they are uncomparable, as there is no way of deeply comparing them by their design.

@kitsonk kitsonk added the good first issue Good for newcomers label Jun 3, 2021
mfulton26 added a commit to mfulton26/deno_std that referenced this issue Jun 3, 2021
- `WeakMap` and `WeakSet` cannot be deeply compared (no `size`, `Symbol.iterator`, etc.)
- `WeakRef` can be dereferenced

Refs denoland#949
mfulton26 added a commit to mfulton26/deno_std that referenced this issue Jun 3, 2021
- `WeakMap` and `WeakSet` cannot be deeply compared (no `size`, `Symbol.iterator`, etc.)
- `WeakRef` can be dereferenced

Refs denoland#949
@kt3k
Copy link
Member

kt3k commented Jun 7, 2021

fixed by #951

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants