mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-03 08:08:43 +00:00
LibJS: Implement Error.prototype.toString()
This commit is contained in:
parent
2636cac6e4
commit
94afcb54de
Notes:
sideshowbarker
2024-07-19 07:58:59 +09:00
Author: https://github.com/linusg
Commit: 94afcb54de
Pull-request: https://github.com/SerenityOS/serenity/pull/1590
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