mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 10:47:35 +00:00
LibJS: Reorganize tests into subfolders
This commit is contained in:
parent
21064a1883
commit
4c48c9d69d
213 changed files with 10 additions and 2 deletions
40
Libraries/LibJS/Tests/builtins/Boolean/Boolean.js
Normal file
40
Libraries/LibJS/Tests/builtins/Boolean/Boolean.js
Normal file
|
@ -0,0 +1,40 @@
|
|||
load("test-common.js");
|
||||
|
||||
try {
|
||||
assert(Boolean.length === 1);
|
||||
assert(Boolean.name === "Boolean");
|
||||
assert(Boolean.prototype.length === undefined);
|
||||
|
||||
assert(typeof new Boolean() === "object");
|
||||
assert(new Boolean().valueOf() === false);
|
||||
|
||||
var foo = new Boolean(true);
|
||||
var bar = new Boolean(true);
|
||||
|
||||
assert(foo !== bar);
|
||||
assert(foo.valueOf() === bar.valueOf());
|
||||
|
||||
assert(new Boolean(true).toString() === "true");
|
||||
assert(new Boolean(false).toString() === "false");
|
||||
|
||||
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;
|
||||
|
||||
console.log("PASS");
|
||||
} catch (err) {
|
||||
console.log("FAIL: " + err);
|
||||
}
|
10
Libraries/LibJS/Tests/builtins/Boolean/Boolean.prototype.js
Normal file
10
Libraries/LibJS/Tests/builtins/Boolean/Boolean.prototype.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
load("test-common.js");
|
||||
|
||||
try {
|
||||
assert(typeof Boolean.prototype === "object");
|
||||
assert(Boolean.prototype.valueOf() === false);
|
||||
|
||||
console.log("PASS");
|
||||
} catch (err) {
|
||||
console.log("FAIL: " + err);
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
load("test-common.js");
|
||||
|
||||
try {
|
||||
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");
|
||||
|
||||
assertThrowsError(() => {
|
||||
Boolean.prototype.toString.call("foo");
|
||||
}, {
|
||||
error: TypeError,
|
||||
message: "Not a Boolean object"
|
||||
});
|
||||
|
||||
console.log("PASS");
|
||||
} catch (err) {
|
||||
console.log("FAIL: " + err);
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
load("test-common.js");
|
||||
|
||||
try {
|
||||
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);
|
||||
|
||||
assertThrowsError(() => {
|
||||
Boolean.prototype.valueOf.call("foo");
|
||||
}, {
|
||||
error: TypeError,
|
||||
message: "Not a Boolean object"
|
||||
});
|
||||
|
||||
console.log("PASS");
|
||||
} catch (err) {
|
||||
console.log("FAIL: " + err);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue