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

index cfaded4e39569af25966ef94501a349027b6442d..1be5950a4ba665c3b51356dfd13a78f692fc90a6 100644 (file)
@@ -202,6 +202,10 @@ describe("ordinaryToPrimitive", () => {
     assertThrows(() => ordinaryToPrimitive(obj));
   });
 
+  it("[[Construct]] throws an error", () => {
+    assertThrows(() => new ordinaryToPrimitive(""));
+  });
+
   describe(".name", () => {
     it("[[Get]] returns the correct name", () => {
       assertStrictEquals(
@@ -250,6 +254,10 @@ describe("sameValue", () => {
     assertStrictEquals(sameValue(false, new Boolean(false)), false);
   });
 
+  it("[[Construct]] throws an error", () => {
+    assertThrows(() => new sameValue(true, true));
+  });
+
   describe(".name", () => {
     it("[[Get]] returns the correct name", () => {
       assertStrictEquals(sameValue.name, "sameValue");
@@ -298,6 +306,10 @@ describe("sameValueZero", () => {
     );
   });
 
+  it("[[Construct]] throws an error", () => {
+    assertThrows(() => new sameValueZero(true, true));
+  });
+
   describe(".name", () => {
     it("[[Get]] returns the correct name", () => {
       assertStrictEquals(sameValueZero.name, "sameValueZero");
@@ -376,7 +388,7 @@ describe("toPrimitive", () => {
         },
       },
     );
-    assertStrictEquals(toPrimitive(value, "default"), "success");
+    assertStrictEquals(toPrimitive(value), "success");
   });
 
   it("[[Call]] throws for an invalid hint", () => {
@@ -401,6 +413,10 @@ describe("toPrimitive", () => {
     assertThrows(() => toPrimitive(true, "badhint"));
   });
 
+  it("[[Construct]] throws an error", () => {
+    assertThrows(() => new toPrimitive(true));
+  });
+
   describe(".name", () => {
     it("[[Get]] returns the correct name", () => {
       assertStrictEquals(toPrimitive.name, "toPrimitive");
@@ -429,6 +445,10 @@ describe("type", () => {
     assertStrictEquals(type(class {}), "object");
   });
 
+  it("[[Construct]] throws an error", () => {
+    assertThrows(() => new type({}));
+  });
+
   describe(".name", () => {
     it("[[Get]] returns the correct name", () => {
       assertStrictEquals(type.name, "type");
This page took 0.082774 seconds and 4 git commands to generate.