1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:17:35 +00:00

LibJS: Implement WeakRef changes from 'Symbol as WeakMap Keys Proposal'

This commit is contained in:
Idan Horowitz 2022-06-22 23:09:59 +03:00
parent dbd0110721
commit 53ed8decaf
6 changed files with 69 additions and 26 deletions

View file

@ -8,7 +8,7 @@ describe("errors", () => {
[-100, Infinity, NaN, 152n, undefined].forEach(value => {
expect(() => {
new WeakRef(value);
}).toThrowWithMessage(TypeError, "is not an object");
}).toThrowWithMessage(TypeError, "cannot be held weakly");
});
});
test("called without new", () => {
@ -27,4 +27,9 @@ describe("normal behavior", () => {
var a = new WeakRef({});
expect(a instanceof WeakRef).toBeTrue();
});
test("constructor with single symbol argument", () => {
var a = new WeakRef(Symbol());
expect(a instanceof WeakRef).toBeTrue();
});
});