From: Lady <redacted>
Date: Mon, 4 Sep 2023 19:47:12 +0000 (-0400)
Subject: Test function.js non·constructor constructability
X-Git-Url: https://git.ladys.computer/Pisces/commitdiff_plain/b2830c510b0bec4c7e10a62acf7a3119732f2d55?ds=inline;hp=d807b9e7794776e0fad49b968346e94322d43a73

Test function.js non·constructor constructability
---

diff --git a/function.test.js b/function.test.js
index e928662..35f7f37 100644
--- a/function.test.js
+++ b/function.test.js
@@ -70,6 +70,10 @@ describe("bind", () => {
     );
   });
 
+  it("[[Construct]] throws an error", () => {
+    assertThrows(() => new bind(function () {}));
+  });
+
   describe(".name", () => {
     it("[[Get]] returns the correct name", () => {
       assertStrictEquals(bind.name, "bind");
@@ -122,6 +126,10 @@ describe("call", () => {
     );
   });
 
+  it("[[Construct]] throws an error", () => {
+    assertThrows(() => new call(function () {}, null, []));
+  });
+
   describe(".name", () => {
     it("[[Get]] returns the correct name", () => {
       assertStrictEquals(call.name, "call");
@@ -144,15 +152,15 @@ describe("completesNormally", () => {
   });
 
   it("[[Call]] throws when the argument is not callable", () => {
-    assertThrows(() => {
-      completesNormally(null);
-    });
+    assertThrows(() => completesNormally(null));
   });
 
   it("[[Call]] throws when the argument is not provided", () => {
-    assertThrows(() => {
-      completesNormally();
-    });
+    assertThrows(() => completesNormally());
+  });
+
+  it("[[Construct]] throws an error", () => {
+    assertThrows(() => new completesNormally(function () {}));
   });
 
   describe(".name", () => {
@@ -219,6 +227,10 @@ describe("construct", () => {
     );
   });
 
+  it("[[Construct]] throws an error", () => {
+    assertThrows(() => new construct(function () {}, []));
+  });
+
   describe(".name", () => {
     it("[[Get]] returns the correct name", () => {
       assertStrictEquals(construct.name, "construct");
@@ -304,6 +316,10 @@ describe("isCallable", () => {
     assertStrictEquals(isCallable({}), false);
   });
 
+  it("[[Construct]] throws an error", () => {
+    assertThrows(() => new isCallable(function () {}));
+  });
+
   describe(".name", () => {
     it("[[Get]] returns the correct name", () => {
       assertStrictEquals(isCallable.name, "isCallable");
@@ -366,6 +382,10 @@ describe("isConstructor", () => {
     assertStrictEquals(isConstructor({}), false);
   });
 
+  it("[[Construct]] throws an error", () => {
+    assertThrows(() => new isConstructor(function () {}));
+  });
+
   describe(".name", () => {
     it("[[Get]] returns the correct name", () => {
       assertStrictEquals(isConstructor.name, "isConstructor");
@@ -396,6 +416,10 @@ describe("makeCallable", () => {
     );
   });
 
+  it("[[Construct]] throws an error", () => {
+    assertThrows(() => new makeCallable(function () {}));
+  });
+
   describe(".name", () => {
     it("[[Get]] returns the correct name", () => {
       assertStrictEquals(makeCallable.name, "makeCallable");
@@ -419,6 +443,10 @@ describe("ordinaryHasInstance", () => {
     );
   });
 
+  it("[[Construct]] throws an error", () => {
+    assertThrows(() => new ordinaryHasInstance(function () {}, {}));
+  });
+
   describe(".name", () => {
     it("[[Get]] returns the correct name", () => {
       assertStrictEquals(