1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 10:37:45 +00:00

LibJS: Implement Error.prototype.toString()

This commit is contained in:
Linus Groh 2020-04-02 21:16:13 +01:00 committed by Andreas Kling
parent 2636cac6e4
commit 94afcb54de
3 changed files with 39 additions and 0 deletions

View file

@ -0,0 +1,13 @@
function assert(x) { if (!x) throw 1; }
try {
assert(Error().toString() === "Error");
assert(Error(undefined).toString() === "Error");
assert(Error(null).toString() === "Error: null");
assert(Error("test").toString() === "Error: test");
assert(Error(42).toString() === "Error: 42");
console.log("PASS");
} catch (e) {
console.log("FAIL: " + e);
}