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

Function TestDefaultBacktrackingStackLimit

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

Source from the content-addressed store, hash-verified

32}
33
34func TestDefaultBacktrackingStackLimit(t *testing.T) {
35 re := MustCompile(`(?:^){60000}`)
36 matched, err := re.MatchString("")
37 if matched {
38 t.Fatal("MatchString unexpectedly matched")
39 }
40 if !errors.Is(err, ErrBacktrackingStackLimit) {
41 t.Fatalf("MatchString error = %v, want ErrBacktrackingStackLimit", err)
42 }
43}
44
45func TestBacktrackingStackLimitOverride(t *testing.T) {
46 for _, limit := range []int{200000, -1} {

Callers

nothing calls this directly

Calls 2

MustCompileFunction · 0.70
MatchStringMethod · 0.65

Tested by

no test coverage detected