Skip to content

Commit c8a24b9

Browse files
committed
Add more tests to string.find
1 parent f04877f commit c8a24b9

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

internal/lua/stringlib_test.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ func TestStringFind(t *testing.T) {
3131
init: 1,
3232
want: []any{int64(1), int64(0)},
3333
},
34+
{
35+
s: "aaa",
36+
pattern: "^a",
37+
init: 1,
38+
want: []any{int64(1), int64(1)},
39+
},
40+
{
41+
s: "aaa",
42+
pattern: "^a",
43+
init: 2,
44+
want: []any{int64(2), int64(2)},
45+
},
3446
{
3547
s: "alo",
3648
pattern: "",
@@ -305,7 +317,7 @@ func TestStringFind(t *testing.T) {
305317
s: "]]]áb",
306318
pattern: "[^]]+",
307319
init: 1,
308-
want: []any{int64(1), int64(3)},
320+
want: []any{int64(4), int64(6)},
309321
},
310322
{
311323
s: "0alo alo",

0 commit comments

Comments
 (0)