diff options
author | Linus Groh <mail@linusgroh.de> | 2020-04-02 21:16:13 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-04-03 09:07:05 +0200 |
commit | 94afcb54de07499d15fe8e601127148bba022f96 (patch) | |
tree | 741131dcb851e9d1e0c6342beaf3d369fcaec6ab /Libraries/LibJS/Tests | |
parent | 2636cac6e4705714305fd13e6ac7b0d93f75e225 (diff) | |
download | serenity-94afcb54de07499d15fe8e601127148bba022f96.zip |
LibJS: Implement Error.prototype.toString()
Diffstat (limited to 'Libraries/LibJS/Tests')
-rw-r--r-- | Libraries/LibJS/Tests/Error.prototype.toString.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Libraries/LibJS/Tests/Error.prototype.toString.js b/Libraries/LibJS/Tests/Error.prototype.toString.js new file mode 100644 index 0000000000..cc0b8185c0 --- /dev/null +++ b/Libraries/LibJS/Tests/Error.prototype.toString.js @@ -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); +} |