1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:38:11 +00:00

LibJS: Add "name" property to functions

This commit is contained in:
Linus Groh 2020-05-02 19:18:55 +01:00 committed by Andreas Kling
parent d007e8d00f
commit 99be27b4a1
16 changed files with 118 additions and 16 deletions

View 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);
}