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:
parent
2636cac6e4
commit
94afcb54de
3 changed files with 39 additions and 0 deletions
13
Libraries/LibJS/Tests/Error.prototype.toString.js
Normal file
13
Libraries/LibJS/Tests/Error.prototype.toString.js
Normal 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);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue