mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-01 03:57:15 +02:00
LibJS: Add in-tree test for Json parsing of negative zeros
This mirrors the cases in `built-ins/JSON/parse/text-negative-zero` in test262
This commit is contained in:
committed by
Linus Groh
parent
1d95fd5443
commit
71ab8fb757
Notes:
sideshowbarker
2024-07-17 20:37:18 +09:00
Author: https://github.com/ForLoveOfCats Commit: https://github.com/SerenityOS/serenity/commit/71ab8fb757f Pull-request: https://github.com/SerenityOS/serenity/pull/12004 Reviewed-by: https://github.com/linusg ✅
@@ -35,3 +35,11 @@ test("syntax errors", () => {
|
||||
}).toThrow(SyntaxError);
|
||||
});
|
||||
});
|
||||
|
||||
test("negative zero", () => {
|
||||
["-0", " \n-0", "-0 \t", "\n\t -0\n ", "-0.0"].forEach(testCase => {
|
||||
expect(JSON.parse(testCase)).toEqual(-0.0);
|
||||
});
|
||||
|
||||
expect(JSON.parse(-0)).toEqual(0);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user