Skip to content

Commit

Permalink
Fix tests with lastIndex -> index
Browse files Browse the repository at this point in the history
  • Loading branch information
davesnx committed Mar 3, 2024
1 parent 6e0849c commit 1894042
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/suite.ml
Original file line number Diff line number Diff line change
Expand Up @@ -173,19 +173,19 @@ let () =
assert_result (RegExp.captures result) [| "0" |]);
test "with y (sticky)" (fun () ->
let regex = RegExp.compile "foo" "y" in
assert_int (RegExp.lastIndex regex) 0;
assert_int (RegExp.index regex) 0;
let input = "foofoofoo" in
let result = RegExp.exec regex input in
assert_int (RegExp.lastIndex regex) 3;
assert_int (RegExp.index regex) 3;
assert_result (RegExp.captures result) [| "foo" |];
let result = RegExp.exec regex input in
assert_int (RegExp.lastIndex regex) 6;
assert_int (RegExp.index regex) 6;
assert_result (RegExp.captures result) [| "foo" |];
let result = RegExp.exec regex input in
assert_int (RegExp.lastIndex regex) 9;
assert_int (RegExp.index regex) 9;
assert_result (RegExp.captures result) [| "foo" |];
let result = RegExp.exec regex input in
assert_int (RegExp.lastIndex regex) 0;
assert_int (RegExp.index regex) 0;
assert_result (RegExp.captures result) [||]);
test "groups" (fun () ->
let regex = RegExp.compile "(xyz)" "" in
Expand Down

0 comments on commit 1894042

Please sign in to comment.