(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestStringIndexPrefixFilter(t *testing.T) { |
| 12 | filter := stringIndexPrefixFilter("abc", false, 3) |
| 13 | if filter == nil { |
| 14 | t.Fatal("expected filter") |
| 15 | } |
| 16 | |
| 17 | candidateByteIndex, ok := filter("xxabc", 0) |
| 18 | if !ok { |
| 19 | t.Fatal("expected candidate") |
| 20 | } |
| 21 | if got, want := candidateByteIndex, 2; got != want { |
| 22 | t.Fatalf("candidateByteIndex = %d, want %d", got, want) |
| 23 | } |
| 24 | |
| 25 | candidateByteIndex, ok = filter("xxabcabc", 3) |
| 26 | if !ok { |
| 27 | t.Fatal("expected candidate after startAt") |
| 28 | } |
| 29 | if got, want := candidateByteIndex, 5; got != want { |
| 30 | t.Fatalf("candidateByteIndex = %d, want %d", got, want) |
| 31 | } |
| 32 | |
| 33 | if _, ok := filter("xxab", 0); ok { |
| 34 | t.Fatal("unexpected candidate for missing prefix") |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | func TestStringFilterInvalidUTF8Regression(t *testing.T) { |
| 39 | for _, pattern := range []string{`�abc`, `(?:�abc|xyz)`, `.�ab`, `[x]*�abc`} { |
nothing calls this directly
no test coverage detected