]> Lady’s Gitweb - Pisces/commitdiff
Test function.js non·constructor constructability
authorLady <redacted>
Mon, 4 Sep 2023 19:47:12 +0000 (15:47 -0400)
committerLady <redacted>
Mon, 4 Sep 2023 19:47:12 +0000 (15:47 -0400)
function.test.js

index e9286624b895a35c4a439c119f56760f558a6f00..35f7f37bc385dd538b82803e945449e20d9a90b7 100644 (file)
@@ -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(
This page took 0.057784 seconds and 4 git commands to generate.