mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 21:29:06 +00:00
LibJS: Add "name" property to functions
This commit is contained in:
parent
d007e8d00f
commit
99be27b4a1
Notes:
sideshowbarker
2024-07-19 07:02:13 +09:00
Author: https://github.com/linusg
Commit: 99be27b4a1
Pull-request: https://github.com/SerenityOS/serenity/pull/2068
16 changed files with 118 additions and 16 deletions
21
Libraries/LibJS/Tests/function-name.js
Normal file
21
Libraries/LibJS/Tests/function-name.js
Normal file
|
@ -0,0 +1,21 @@
|
|||
load("test-common.js");
|
||||
|
||||
try {
|
||||
var f = function () { }
|
||||
assert(f.name === "");
|
||||
assert((f.name = "f") === "f");
|
||||
assert(f.name === "");
|
||||
|
||||
function foo() { }
|
||||
assert(foo.name === "foo");
|
||||
assert((foo.name = "bar") === "bar");
|
||||
assert(foo.name === "foo");
|
||||
|
||||
assert(console.log.name === "log");
|
||||
assert((console.log.name = "warn") === "warn");
|
||||
assert(console.log.name === "log");
|
||||
|
||||
console.log("PASS");
|
||||
} catch (e) {
|
||||
console.log("FAIL: " + e);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue