mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-30 20:59:16 +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
|
@ -2,7 +2,9 @@ load("test-common.js");
|
|||
|
||||
try {
|
||||
assert(Function.length === 1);
|
||||
assert(Function.name === "Function");
|
||||
assert(Function.prototype.length === 0);
|
||||
assert(Function.prototype.name === "");
|
||||
|
||||
assert(typeof Function() === "function");
|
||||
assert(typeof new Function() === "function");
|
||||
|
@ -21,6 +23,7 @@ try {
|
|||
assert(new Function("return typeof Function()")() === "function");
|
||||
assert(new Function("x", "return function (y) { return x + y };")(1)(2) === 3);
|
||||
|
||||
assert(new Function().name === "anonymous");
|
||||
assert(new Function().toString() === "function anonymous() {\n ???\n}");
|
||||
|
||||
console.log("PASS");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue