]> Lady’s Gitweb - Pisces/blobdiff - string.test.js
Add toIntegralNumber to numeric.js
[Pisces] / string.test.js
index 52e848c3b75bcde588593512b66137d20ce34c22..6407d9415b2aa469006e517db5fc66adbd2c93e7 100644 (file)
@@ -95,15 +95,15 @@ describe("Matcher", () => {
 
     it("[[Call]] calls the constraint if the match succeeds", () => {
       const constraint = spy((_) => true);
-      const matcher = new Matcher(".*", undefined, constraint);
-      matcher.exec({
+      const matcher = new Matcher("(.).*", undefined, constraint);
+      const result = matcher.exec({
         toString() {
           return "etaoin";
         },
       });
       assertSpyCalls(constraint, 1);
       assertSpyCall(constraint, 0, {
-        args: ["etaoin", matcher],
+        args: ["etaoin", result, matcher],
         self: undefined,
       });
     });
@@ -204,13 +204,13 @@ describe("Matcher", () => {
 
     it("[[Call]] calls the constraint if the match succeeds", () => {
       const constraint = spy((_) => true);
-      const matcher = new Matcher(".*", undefined, constraint);
+      const matcher = new Matcher("(.).*", undefined, constraint);
       matcher("etaoin");
       assertSpyCalls(constraint, 1);
-      assertSpyCall(constraint, 0, {
-        args: ["etaoin", matcher],
-        self: undefined,
-      });
+      assertEquals(constraint.calls[0].args[0], "etaoin");
+      assertEquals([...constraint.calls[0].args[1]], ["etaoin", "e"]);
+      assertEquals(constraint.calls[0].args[2], matcher);
+      assertEquals(constraint.calls[0].self, undefined);
     });
 
     it("[[Call]] does not call the constraint if the match fails", () => {
This page took 0.020512 seconds and 4 git commands to generate.