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

Function TestFixedDistanceStringFindFirstChar

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

Source from the content-addressed store, hash-verified

290}
291
292func TestFixedDistanceStringFindFirstChar(t *testing.T) {
293 re := MustCompile(`..abc`)
294 m, err := re.FindStringMatch("zzxxabc")
295 if err != nil {
296 t.Fatalf("FindStringMatch failed: %v", err)
297 }
298 if m == nil {
299 t.Fatal("expected match")
300 }
301 if got, want := m.RuneIndex, 2; got != want {
302 t.Fatalf("match index = %d, want %d", got, want)
303 }
304}
305
306func TestMinRequiredLengthShortCircuits(t *testing.T) {
307 re := MustCompile(`abc`)

Callers

nothing calls this directly

Calls 2

FindStringMatchMethod · 0.80
MustCompileFunction · 0.70

Tested by

no test coverage detected