diff options
Diffstat (limited to 'Libraries/LibJS/Tests/function-name.js')
-rw-r--r-- | Libraries/LibJS/Tests/function-name.js | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Libraries/LibJS/Tests/function-name.js b/Libraries/LibJS/Tests/function-name.js new file mode 100644 index 0000000000..163dbab8b1 --- /dev/null +++ b/Libraries/LibJS/Tests/function-name.js @@ -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); +} |