mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-02 01:08:48 +00:00
LibJS: Fix parsing of numeric object keys
Numeric keys were interpreted as their source text, leading to something like {0x10:true} to end up as {"0x10":true} instead of {16:true}
This commit is contained in:
parent
fdacfefd09
commit
be9c2feff0
Notes:
sideshowbarker
2024-07-19 00:32:19 +09:00
Author: https://github.com/sunverwerth
Commit: be9c2feff0
Pull-request: https://github.com/SerenityOS/serenity/pull/3803
Reviewed-by: https://github.com/linusg
2 changed files with 9 additions and 4 deletions
|
@ -39,6 +39,13 @@ describe("correct behavior", () => {
|
|||
expect(object[symbol]).toBe(2);
|
||||
});
|
||||
|
||||
test("numeric keys", () => {
|
||||
expect({0x10:true}).toBe({16:true});
|
||||
expect({0b10:true}).toBe({2:true});
|
||||
expect({0o10:true}).toBe({8:true});
|
||||
expect({.5:true}).toBe({"0.5":true});
|
||||
});
|
||||
|
||||
test("computed properties", () => {
|
||||
const foo = "bar";
|
||||
const computed = "computed";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue