mirror of
https://github.com/RGBCube/serenity
synced 2025-07-03 00:52:12 +00:00
Base+LibJS+LibWeb: Make prettier clean
Also use "// prettier-ignore" comments where necessary rather than excluding whole files (via .prettierignore).
This commit is contained in:
parent
76239f89c2
commit
5122f98198
24 changed files with 100 additions and 79 deletions
|
@ -2,33 +2,33 @@ test("basic parseInt() functionality", () => {
|
|||
expect(parseInt("0")).toBe(0);
|
||||
expect(parseInt("100")).toBe(100);
|
||||
expect(parseInt("1000", 16)).toBe(4096);
|
||||
expect(parseInt('0xF', 16)).toBe(15)
|
||||
expect(parseInt('F', 16)).toBe(15)
|
||||
expect(parseInt('17', 8)).toBe(15)
|
||||
expect(parseInt(021, 8)).toBe(15)
|
||||
expect(parseInt('015', 10)).toBe(15)
|
||||
expect(parseInt(15.99, 10)).toBe(15)
|
||||
expect(parseInt('15,123', 10)).toBe(15)
|
||||
expect(parseInt('FXX123', 16)).toBe(15)
|
||||
expect(parseInt('1111', 2)).toBe(15)
|
||||
expect(parseInt('15 * 3', 10)).toBe(15)
|
||||
expect(parseInt('15e2', 10)).toBe(15)
|
||||
expect(parseInt('15px', 10)).toBe(15)
|
||||
expect(parseInt('12', 13)).toBe(15)
|
||||
expect(parseInt('Hello', 8)).toBeNaN();
|
||||
expect(parseInt('546', 2)).toBeNaN();
|
||||
expect(parseInt('-F', 16)).toBe(-15);
|
||||
expect(parseInt('-0F', 16)).toBe(-15);
|
||||
expect(parseInt('-0XF', 16)).toBe(-15);
|
||||
expect(parseInt("0xF", 16)).toBe(15);
|
||||
expect(parseInt("F", 16)).toBe(15);
|
||||
expect(parseInt("17", 8)).toBe(15);
|
||||
expect(parseInt(021, 8)).toBe(15);
|
||||
expect(parseInt("015", 10)).toBe(15);
|
||||
expect(parseInt(15.99, 10)).toBe(15);
|
||||
expect(parseInt("15,123", 10)).toBe(15);
|
||||
expect(parseInt("FXX123", 16)).toBe(15);
|
||||
expect(parseInt("1111", 2)).toBe(15);
|
||||
expect(parseInt("15 * 3", 10)).toBe(15);
|
||||
expect(parseInt("15e2", 10)).toBe(15);
|
||||
expect(parseInt("15px", 10)).toBe(15);
|
||||
expect(parseInt("12", 13)).toBe(15);
|
||||
expect(parseInt("Hello", 8)).toBeNaN();
|
||||
expect(parseInt("546", 2)).toBeNaN();
|
||||
expect(parseInt("-F", 16)).toBe(-15);
|
||||
expect(parseInt("-0F", 16)).toBe(-15);
|
||||
expect(parseInt("-0XF", 16)).toBe(-15);
|
||||
expect(parseInt(-15.1, 10)).toBe(-15);
|
||||
expect(parseInt('-17', 8)).toBe(-15);
|
||||
expect(parseInt('-15', 10)).toBe(-15);
|
||||
expect(parseInt('-1111', 2)).toBe(-15);
|
||||
expect(parseInt('-15e1', 10)).toBe(-15);
|
||||
expect(parseInt('-12', 13)).toBe(-15);
|
||||
expect(parseInt("-17", 8)).toBe(-15);
|
||||
expect(parseInt("-15", 10)).toBe(-15);
|
||||
expect(parseInt("-1111", 2)).toBe(-15);
|
||||
expect(parseInt("-15e1", 10)).toBe(-15);
|
||||
expect(parseInt("-12", 13)).toBe(-15);
|
||||
expect(parseInt(4.7, 10)).toBe(4);
|
||||
expect(parseInt('0e0', 16)).toBe(224);
|
||||
expect(parseInt('123_456')).toBe(123);
|
||||
expect(parseInt("0e0", 16)).toBe(224);
|
||||
expect(parseInt("123_456")).toBe(123);
|
||||
|
||||
// FIXME: expect(parseInt(4.7 * 1e22, 10)).toBe(4);
|
||||
// FIXME: expect(parseInt(0.00000000000434, 10)).toBe(4);
|
||||
|
@ -42,10 +42,18 @@ test("basic parseInt() functionality", () => {
|
|||
});
|
||||
|
||||
test("parseInt() radix is coerced to a number", () => {
|
||||
const obj = { valueOf() { return 8; } };
|
||||
expect(parseInt('11', obj)).toBe(9);
|
||||
obj.valueOf = function() { return 1; }
|
||||
expect(parseInt('11', obj)).toBeNaN();
|
||||
obj.valueOf = function() { return Infinity; }
|
||||
expect(parseInt('11', obj)).toBe(11);
|
||||
const obj = {
|
||||
valueOf() {
|
||||
return 8;
|
||||
},
|
||||
};
|
||||
expect(parseInt("11", obj)).toBe(9);
|
||||
obj.valueOf = function () {
|
||||
return 1;
|
||||
};
|
||||
expect(parseInt("11", obj)).toBeNaN();
|
||||
obj.valueOf = function () {
|
||||
return Infinity;
|
||||
};
|
||||
expect(parseInt("11", obj)).toBe(11);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue