1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:08:12 +00: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:
ForLoveOfCats 2022-01-19 11:42:25 -05:00 committed by Linus Groh
parent 1d95fd5443
commit 71ab8fb757

View file

@ -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);
});