mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:48:11 +00:00
LibJS: Convert most builtin tests to new system
This commit is contained in:
parent
46581773c1
commit
3f97d75778
107 changed files with 2031 additions and 2243 deletions
|
@ -1,33 +1,18 @@
|
|||
load("test-common.js");
|
||||
test("basic functionality", () => {
|
||||
expect(Error).toHaveLength(1);
|
||||
expect(Error.name).toBe("Error");
|
||||
});
|
||||
|
||||
try {
|
||||
assert(Error.length === 1);
|
||||
assert(Error.name === "Error");
|
||||
assert(Error.prototype.length === undefined);
|
||||
test("name", () => {
|
||||
[Error(), Error(undefined), Error("test"), Error(42), Error(null)].forEach(error => {
|
||||
expect(error.name).toBe("Error");
|
||||
});
|
||||
});
|
||||
|
||||
var e;
|
||||
|
||||
e = Error();
|
||||
assert(e.name === "Error");
|
||||
assert(e.message === "");
|
||||
|
||||
e = Error(undefined);
|
||||
assert(e.name === "Error");
|
||||
assert(e.message === "");
|
||||
|
||||
e = Error("test");
|
||||
assert(e.name === "Error");
|
||||
assert(e.message === "test");
|
||||
|
||||
e = Error(42);
|
||||
assert(e.name === "Error");
|
||||
assert(e.message === "42");
|
||||
|
||||
e = Error(null);
|
||||
assert(e.name === "Error");
|
||||
assert(e.message === "null");
|
||||
|
||||
console.log("PASS");
|
||||
} catch (e) {
|
||||
console.log("FAIL: " + e);
|
||||
}
|
||||
test("message", () => {
|
||||
expect(Error().message).toBe("");
|
||||
expect(Error(undefined).message).toBe("");
|
||||
expect(Error("test").message).toBe("test");
|
||||
expect(Error(42).message).toBe("42");
|
||||
expect(Error(null).message).toBe("null");
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue