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:
parent
2ad2e055e2
commit
690eb3bb8a
3 changed files with 34 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue