From: Lady Date: Mon, 4 Sep 2023 22:38:25 +0000 (-0400) Subject: Test createCallableFunction names and lengths X-Git-Url: https://git.ladys.computer/Pisces/commitdiff_plain/b6bd2e5effcc14b40cdd43c6fba9f01c23504ba5 Test createCallableFunction names and lengths --- diff --git a/function.test.js b/function.test.js index 1165d03..dd9b642 100644 --- a/function.test.js +++ b/function.test.js @@ -288,6 +288,34 @@ describe("createCallableFunction", () => { ); }); + it("[[Call]] correctly sets the length", () => { + assertStrictEquals( + createCallableFunction( + function (_a, _b, _c) {}, + ).length, + 4, + ); + }); + + it("[[Call]] correctly sets the name", () => { + assertStrictEquals( + createCallableFunction( + function etaoin() {}, + ).name, + "etaoin", + ); + }); + + it("[[Call]] allows the name to be overridden", () => { + assertStrictEquals( + createCallableFunction( + function etaoin() {}, + "shrdlu", + ).name, + "shrdlu", + ); + }); + it("[[Construct]] throws an error", () => { assertThrows(() => new createCallableFunction(function () {})); });