]> Lady’s Gitweb - Pisces/commitdiff
Test constructability, name, length in iterable.js
authorLady <redacted>
Sat, 21 Oct 2023 19:47:08 +0000 (15:47 -0400)
committerLady <redacted>
Sat, 21 Oct 2023 19:47:08 +0000 (15:47 -0400)
iterable.js
iterable.test.js

index d89e35f6fa703078521228b5b75d6bb4c1d515b0..2eb9aa46120f0183796623854769d2e8f5f94cf7 100644 (file)
@@ -326,7 +326,7 @@ export const {
   const iteratorFunction = (
     makeBaseIterator,
     baseIteratorNext,
-    generateNext = null,
+    generateNext,
     stringTag = "Iterator",
   ) => {
     const prototype = makePrototype(stringTag); // intentionally cached
@@ -335,7 +335,7 @@ export const {
         prototype,
         call(makeBaseIterator, $, []),
         baseIteratorNext,
-        generateNext === null ? null : bind(generateNext, thisArg, []),
+        generateNext == null ? null : bind(generateNext, thisArg, []),
       );
   };
 
index 2e62d5c01146ac9e5e10f2dd1b1b700174501833..0f7c9fcac0a96447695e0d0dd387df808c586f08 100644 (file)
@@ -34,6 +34,25 @@ describe("arrayIteratorFunction", () => {
     );
   });
 
+  it("[[Construct]] throws an error", () => {
+    assertThrows(() => new arrayIteratorFunction());
+  });
+
+  describe(".length", () => {
+    it("[[Get]] returns the correct length", () => {
+      assertStrictEquals(arrayIteratorFunction.length, 1);
+    });
+  });
+
+  describe(".name", () => {
+    it("[[Get]] returns the correct name", () => {
+      assertStrictEquals(
+        arrayIteratorFunction.name,
+        "arrayIteratorFunction",
+      );
+    });
+  });
+
   describe("()", () => {
     it("[[Call]] returns a value which inherits from %IteratorPrototype%", () => {
       const iteratorProto = Object.getPrototypeOf(
@@ -130,6 +149,25 @@ describe("generatorIteratorFunction", () => {
     );
   });
 
+  it("[[Construct]] throws an error", () => {
+    assertThrows(() => new generatorIteratorFunction());
+  });
+
+  describe(".length", () => {
+    it("[[Get]] returns the correct length", () => {
+      assertStrictEquals(generatorIteratorFunction.length, 1);
+    });
+  });
+
+  describe(".name", () => {
+    it("[[Get]] returns the correct name", () => {
+      assertStrictEquals(
+        generatorIteratorFunction.name,
+        "generatorIteratorFunction",
+      );
+    });
+  });
+
   describe("()", () => {
     it("[[Call]] returns a value which inherits from %IteratorPrototype%", () => {
       const iteratorProto = Object.getPrototypeOf(
@@ -248,6 +286,25 @@ describe("mapIteratorFunction", () => {
     );
   });
 
+  it("[[Construct]] throws an error", () => {
+    assertThrows(() => new mapIteratorFunction());
+  });
+
+  describe(".length", () => {
+    it("[[Get]] returns the correct length", () => {
+      assertStrictEquals(mapIteratorFunction.length, 1);
+    });
+  });
+
+  describe(".name", () => {
+    it("[[Get]] returns the correct name", () => {
+      assertStrictEquals(
+        mapIteratorFunction.name,
+        "mapIteratorFunction",
+      );
+    });
+  });
+
   describe("()", () => {
     it("[[Call]] returns a value which inherits from %IteratorPrototype%", () => {
       const iteratorProto = Object.getPrototypeOf(
@@ -344,6 +401,25 @@ describe("setIteratorFunction", () => {
     );
   });
 
+  it("[[Construct]] throws an error", () => {
+    assertThrows(() => new setIteratorFunction());
+  });
+
+  describe(".length", () => {
+    it("[[Get]] returns the correct length", () => {
+      assertStrictEquals(setIteratorFunction.length, 1);
+    });
+  });
+
+  describe(".name", () => {
+    it("[[Get]] returns the correct name", () => {
+      assertStrictEquals(
+        setIteratorFunction.name,
+        "setIteratorFunction",
+      );
+    });
+  });
+
   describe("()", () => {
     it("[[Call]] returns a value which inherits from %IteratorPrototype%", () => {
       const iteratorProto = Object.getPrototypeOf(
@@ -440,6 +516,25 @@ describe("stringIteratorFunction", () => {
     );
   });
 
+  it("[[Construct]] throws an error", () => {
+    assertThrows(() => new stringIteratorFunction());
+  });
+
+  describe(".length", () => {
+    it("[[Get]] returns the correct length", () => {
+      assertStrictEquals(stringIteratorFunction.length, 1);
+    });
+  });
+
+  describe(".name", () => {
+    it("[[Get]] returns the correct name", () => {
+      assertStrictEquals(
+        stringIteratorFunction.name,
+        "stringIteratorFunction",
+      );
+    });
+  });
+
   describe("()", () => {
     it("[[Call]] returns a value which inherits from %IteratorPrototype%", () => {
       const iteratorProto = Object.getPrototypeOf(
This page took 0.025677 seconds and 4 git commands to generate.