1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:38:12 +00:00

LibJS: Add support for hex, octal & binary big integer literals

This commit is contained in:
Idan Horowitz 2021-06-14 02:19:23 +03:00 committed by Linus Groh
parent 2ad2e055e2
commit 690eb3bb8a
3 changed files with 34 additions and 0 deletions

View file

@ -7,6 +7,18 @@ describe("correct behavior", () => {
expect("" + 123n).toBe("123");
});
test("hex literals", () => {
expect(0xffn).toBe(255n);
});
test("octal literals", () => {
expect(0o10n).toBe(8n);
});
test("binary literals", () => {
expect(0b10n).toBe(2n);
});
test("arithmetic operators", () => {
let bigint = 123n;
expect(-bigint).toBe(-123n);