+describe("createArrowFunction", () => {
+ it("[[Call]] sets this to undefined", () => {
+ assertStrictEquals(
+ createArrowFunction(
+ function () {
+ return this;
+ },
+ ).call("fail"),
+ undefined,
+ );
+ });
+
+ it("[[Call]] transfers the provided arguments", () => {
+ assertEquals(
+ createArrowFunction(
+ function (...args) {
+ return [this, ...args];
+ },
+ ).call("failure", "etaoin", "shrdlu", "cmfwyp"),
+ [undefined, "etaoin", "shrdlu", "cmfwyp"],
+ );
+ });
+
+ it("[[Call]] correctly sets the length", () => {
+ assertStrictEquals(
+ createArrowFunction(
+ function (_a, _b, _c) {},
+ ).length,
+ 3,
+ );
+ });
+
+ it("[[Call]] correctly sets the name", () => {
+ assertStrictEquals(
+ createArrowFunction(
+ function etaoin() {},
+ ).name,
+ "etaoin",
+ );
+ });
+
+ it("[[Call]] allows the length to be overridden", () => {
+ assertStrictEquals(
+ createArrowFunction(
+ function etaoin() {},
+ { length: 100 },
+ ).length,
+ 100,
+ );
+ });
+
+ it("[[Call]] allows the name to be overridden", () => {
+ assertStrictEquals(
+ createArrowFunction(
+ function etaoin() {},
+ { name: "shrdlu" },
+ ).name,
+ "shrdlu",
+ );
+ });
+
+ it("[[Call]] returns an arrow function", () => {
+ assertThrows(() => new (createArrowFunction(function () {}))());
+ });
+
+ it("[[Call]] returns a function with no prototype property", () => {
+ assert(
+ !("prototype" in
+ createArrowFunction(function () {}, { prototype: {} })),
+ );
+ });
+
+ it("[[Construct]] throws an error", () => {
+ assertThrows(() => new createArrowFunction(function () {}));
+ });
+
+ describe(".length", () => {
+ it("[[Get]] returns the correct length", () => {
+ assertStrictEquals(createArrowFunction.length, 1);
+ });
+ });
+
+ describe(".name", () => {
+ it("[[Get]] returns the correct name", () => {
+ assertStrictEquals(
+ createArrowFunction.name,
+ "createArrowFunction",
+ );
+ });
+ });
+});
+