summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Tests/syntax
diff options
context:
space:
mode:
authordavidot <davidot@serenityos.org>2022-08-20 00:24:30 +0200
committerLinus Groh <mail@linusgroh.de>2022-08-24 23:27:17 +0100
commitfce2b33758586d9d928e14416815b8feba55c953 (patch)
tree62be01ef34384078bf3f6693f16c33f017670685 /Userland/Libraries/LibJS/Tests/syntax
parente663504df13029bf1e6656bcb3ae5074d978694a (diff)
downloadserenity-fce2b33758586d9d928e14416815b8feba55c953.zip
LibJS: Allow BigInts as destructuring property names
These are simply treated as their numerical value which means that above 2^32 - 1 they are strings.
Diffstat (limited to 'Userland/Libraries/LibJS/Tests/syntax')
-rw-r--r--Userland/Libraries/LibJS/Tests/syntax/destructuring-assignment.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Tests/syntax/destructuring-assignment.js b/Userland/Libraries/LibJS/Tests/syntax/destructuring-assignment.js
index 9a7682ddbc..5654568a83 100644
--- a/Userland/Libraries/LibJS/Tests/syntax/destructuring-assignment.js
+++ b/Userland/Libraries/LibJS/Tests/syntax/destructuring-assignment.js
@@ -223,4 +223,11 @@ describe("evaluating", () => {
expect(x).toBe("foo");
expect(a).toBe(o.a);
});
+
+ test("can use big int values as number-like properties", () => {
+ let o = { "99999999999999999": 1 };
+ let { 123n: a = "foo", 99999999999999999n: b = "bar" } = o;
+ expect(a).toBe("foo");
+ expect(b).toBe(1);
+ });
});