MCPcopy Create free account
hub / github.com/dlclark/regexp2 / TestFixedDistanceStringFindFirstChar

Function TestFixedDistanceStringFindFirstChar

regexp_optimization_test.go:235–247  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

233}
234
235func TestFixedDistanceStringFindFirstChar(t *testing.T) {
236 re := MustCompile(`..abc`)
237 m, err := re.FindStringMatch("zzxxabc")
238 if err != nil {
239 t.Fatalf("FindStringMatch failed: %v", err)
240 }
241 if m == nil {
242 t.Fatal("expected match")
243 }
244 if got, want := m.RuneIndex, 2; got != want {
245 t.Fatalf("match index = %d, want %d", got, want)
246 }
247}
248
249func TestMinRequiredLengthShortCircuits(t *testing.T) {
250 re := MustCompile(`abc`)

Callers

nothing calls this directly

Calls 2

FindStringMatchMethod · 0.80
MustCompileFunction · 0.70

Tested by

no test coverage detected