mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:48:11 +00:00
LibJS: Fix test files indentation (4 spaces)
This commit is contained in:
parent
0040d6bf2d
commit
92a9fe0e49
8 changed files with 111 additions and 111 deletions
|
@ -1,35 +1,35 @@
|
|||
try {
|
||||
assert(Boolean.length === 1);
|
||||
assert(typeof new Boolean() === "object");
|
||||
assert(new Boolean().valueOf() === false);
|
||||
assert(Boolean.length === 1);
|
||||
assert(typeof new Boolean() === "object");
|
||||
assert(new Boolean().valueOf() === false);
|
||||
|
||||
var foo = new Boolean(true);
|
||||
var bar = new Boolean(true);
|
||||
var foo = new Boolean(true);
|
||||
var bar = new Boolean(true);
|
||||
|
||||
assert(foo !== bar);
|
||||
assert(foo.valueOf() === bar.valueOf());
|
||||
assert(foo !== bar);
|
||||
assert(foo.valueOf() === bar.valueOf());
|
||||
|
||||
assert(new Boolean(true).toString() === "true");
|
||||
assert(new Boolean(false).toString() === "false");
|
||||
assert(new Boolean(true).toString() === "true");
|
||||
assert(new Boolean(false).toString() === "false");
|
||||
|
||||
assert(typeof Boolean() === "boolean");
|
||||
assert(typeof Boolean(true) === "boolean");
|
||||
assert(typeof Boolean() === "boolean");
|
||||
assert(typeof Boolean(true) === "boolean");
|
||||
|
||||
assert(Boolean() === false);
|
||||
assert(Boolean(false) === false);
|
||||
assert(Boolean(null) === false);
|
||||
assert(Boolean(undefined) === false);
|
||||
assert(Boolean(NaN) === false);
|
||||
assert(Boolean("") === false);
|
||||
assert(Boolean(0.0) === false);
|
||||
assert(Boolean(-0.0) === false);
|
||||
assert(Boolean(true) === true);
|
||||
assert(Boolean("0") === true);
|
||||
assert(Boolean({}) === true);
|
||||
assert(Boolean([]) === true);
|
||||
assert(Boolean(1)) === true;
|
||||
assert(Boolean() === false);
|
||||
assert(Boolean(false) === false);
|
||||
assert(Boolean(null) === false);
|
||||
assert(Boolean(undefined) === false);
|
||||
assert(Boolean(NaN) === false);
|
||||
assert(Boolean("") === false);
|
||||
assert(Boolean(0.0) === false);
|
||||
assert(Boolean(-0.0) === false);
|
||||
assert(Boolean(true) === true);
|
||||
assert(Boolean("0") === true);
|
||||
assert(Boolean({}) === true);
|
||||
assert(Boolean([]) === true);
|
||||
assert(Boolean(1)) === true;
|
||||
|
||||
console.log("PASS");
|
||||
console.log("PASS");
|
||||
} catch (err) {
|
||||
console.log("FAIL: " + err);
|
||||
console.log("FAIL: " + err);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
try {
|
||||
assert(typeof Boolean.prototype === "object");
|
||||
assert(Boolean.prototype.valueOf() === false);
|
||||
assert(typeof Boolean.prototype === "object");
|
||||
assert(Boolean.prototype.valueOf() === false);
|
||||
|
||||
console.log("PASS");
|
||||
console.log("PASS");
|
||||
} catch (err) {
|
||||
console.log("FAIL: " + err);
|
||||
console.log("FAIL: " + err);
|
||||
}
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
try {
|
||||
var foo = true;
|
||||
assert(foo.toString() === "true");
|
||||
assert(true.toString() === "true");
|
||||
var foo = true;
|
||||
assert(foo.toString() === "true");
|
||||
assert(true.toString() === "true");
|
||||
|
||||
assert(Boolean.prototype.toString.call(true) === "true");
|
||||
assert(Boolean.prototype.toString.call(false) === "false");
|
||||
assert(Boolean.prototype.toString.call(true) === "true");
|
||||
assert(Boolean.prototype.toString.call(false) === "false");
|
||||
|
||||
let error = null;
|
||||
try {
|
||||
Boolean.prototype.toString.call("foo");
|
||||
} catch (err) {
|
||||
error = err;
|
||||
}
|
||||
let error = null;
|
||||
try {
|
||||
Boolean.prototype.toString.call("foo");
|
||||
} catch (err) {
|
||||
error = err;
|
||||
}
|
||||
|
||||
assert(error instanceof Error);
|
||||
assert(error.name === "TypeError");
|
||||
assert(error.message === "Not a Boolean");
|
||||
assert(error instanceof Error);
|
||||
assert(error.name === "TypeError");
|
||||
assert(error.message === "Not a Boolean");
|
||||
|
||||
console.log("PASS");
|
||||
console.log("PASS");
|
||||
} catch (err) {
|
||||
console.log("FAIL: " + err);
|
||||
console.log("FAIL: " + err);
|
||||
}
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
try {
|
||||
var foo = true;
|
||||
assert(foo.valueOf() === true);
|
||||
assert(true.valueOf() === true);
|
||||
var foo = true;
|
||||
assert(foo.valueOf() === true);
|
||||
assert(true.valueOf() === true);
|
||||
|
||||
assert(Boolean.prototype.valueOf.call(true) === true);
|
||||
assert(Boolean.prototype.valueOf.call(false) === false);
|
||||
assert(Boolean.prototype.valueOf.call(true) === true);
|
||||
assert(Boolean.prototype.valueOf.call(false) === false);
|
||||
|
||||
let error = null;
|
||||
try {
|
||||
Boolean.prototype.valueOf.call("foo");
|
||||
} catch (err) {
|
||||
error = err;
|
||||
}
|
||||
let error = null;
|
||||
try {
|
||||
Boolean.prototype.valueOf.call("foo");
|
||||
} catch (err) {
|
||||
error = err;
|
||||
}
|
||||
|
||||
assert(error instanceof Error);
|
||||
assert(error.name === "TypeError");
|
||||
assert(error.message === "Not a Boolean");
|
||||
assert(error instanceof Error);
|
||||
assert(error.name === "TypeError");
|
||||
assert(error.message === "Not a Boolean");
|
||||
|
||||
console.log("PASS");
|
||||
console.log("PASS");
|
||||
} catch (err) {
|
||||
console.log("FAIL: " + err);
|
||||
console.log("FAIL: " + err);
|
||||
}
|
||||
|
|
|
@ -1,56 +1,56 @@
|
|||
try {
|
||||
let getNumber = () => 42;
|
||||
assert(getNumber() === 42);
|
||||
let getNumber = () => 42;
|
||||
assert(getNumber() === 42);
|
||||
|
||||
let add = (a, b) => a + b;
|
||||
assert(add(2, 3) === 5);
|
||||
let add = (a, b) => a + b;
|
||||
assert(add(2, 3) === 5);
|
||||
|
||||
const addBlock = (a, b) => {
|
||||
let res = a + b;
|
||||
return res;
|
||||
};
|
||||
assert(addBlock(5, 4) === 9);
|
||||
const addBlock = (a, b) => {
|
||||
let res = a + b;
|
||||
return res;
|
||||
};
|
||||
assert(addBlock(5, 4) === 9);
|
||||
|
||||
const makeObject = (a, b) => ({ a, b });
|
||||
const obj = makeObject(33, 44);
|
||||
assert(typeof obj === "object");
|
||||
assert(obj.a === 33);
|
||||
assert(obj.b === 44);
|
||||
const makeObject = (a, b) => ({ a, b });
|
||||
const obj = makeObject(33, 44);
|
||||
assert(typeof obj === "object");
|
||||
assert(obj.a === 33);
|
||||
assert(obj.b === 44);
|
||||
|
||||
let returnUndefined = () => {};
|
||||
assert(typeof returnUndefined() === "undefined");
|
||||
let returnUndefined = () => { };
|
||||
assert(typeof returnUndefined() === "undefined");
|
||||
|
||||
const makeArray = (a, b) => [a, b];
|
||||
const array = makeArray("3", { foo: 4 });
|
||||
assert(array[0] === "3");
|
||||
assert(array[1].foo === 4);
|
||||
const makeArray = (a, b) => [a, b];
|
||||
const array = makeArray("3", { foo: 4 });
|
||||
assert(array[0] === "3");
|
||||
assert(array[1].foo === 4);
|
||||
|
||||
let square = x => x * x;
|
||||
assert(square(3) === 9);
|
||||
let square = x => x * x;
|
||||
assert(square(3) === 9);
|
||||
|
||||
let squareBlock = x => {
|
||||
return x * x;
|
||||
};
|
||||
assert(squareBlock(4) === 16);
|
||||
let squareBlock = x => {
|
||||
return x * x;
|
||||
};
|
||||
assert(squareBlock(4) === 16);
|
||||
|
||||
const message = (who => "Hello " + who)("friends!");
|
||||
assert(message === "Hello friends!");
|
||||
const message = (who => "Hello " + who)("friends!");
|
||||
assert(message === "Hello friends!");
|
||||
|
||||
const sum = ((x, y, z) => x + y + z)(1, 2, 3);
|
||||
assert(sum === 6);
|
||||
const sum = ((x, y, z) => x + y + z)(1, 2, 3);
|
||||
assert(sum === 6);
|
||||
|
||||
const product = ((x, y, z) => {
|
||||
let res = x * y * z;
|
||||
return res;
|
||||
})(5, 4, 2);
|
||||
assert(product === 40);
|
||||
const product = ((x, y, z) => {
|
||||
let res = x * y * z;
|
||||
return res;
|
||||
})(5, 4, 2);
|
||||
assert(product === 40);
|
||||
|
||||
const half = (x => {
|
||||
return x / 2;
|
||||
})(10);
|
||||
assert(half === 5);
|
||||
const half = (x => {
|
||||
return x / 2;
|
||||
})(10);
|
||||
assert(half === 5);
|
||||
|
||||
console.log("PASS");
|
||||
console.log("PASS");
|
||||
} catch {
|
||||
console.log("FAIL");
|
||||
console.log("FAIL");
|
||||
}
|
||||
|
|
|
@ -2,9 +2,9 @@ var a = "foo";
|
|||
|
||||
switch (a + "bar") {
|
||||
case 1:
|
||||
break;
|
||||
break;
|
||||
case "foobar":
|
||||
case 2:
|
||||
console.log("PASS");
|
||||
break;
|
||||
console.log("PASS");
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -2,5 +2,5 @@ var a = "foo";
|
|||
|
||||
switch (100) {
|
||||
default:
|
||||
console.log("PASS");
|
||||
console.log("PASS");
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
switch (1 + 2) {
|
||||
case 3:
|
||||
console.log("PASS");
|
||||
break;
|
||||
console.log("PASS");
|
||||
break;
|
||||
case 5:
|
||||
case 1:
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue