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

Function TestBacktrackingStackLimitOverride

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

Source from the content-addressed store, hash-verified

43}
44
45func TestBacktrackingStackLimitOverride(t *testing.T) {
46 for _, limit := range []int{200000, -1} {
47 t.Run(strconv.Itoa(limit), func(t *testing.T) {
48 re := MustCompile(`(?:^){60000}`, OptionMaxBacktrackingStackSize(limit))
49 matched, err := re.MatchString("")
50 if err != nil {
51 t.Fatalf("MatchString failed: %v", err)
52 }
53 if !matched {
54 t.Fatal("MatchString did not match")
55 }
56 })
57 }
58}
59
60func TestRunnerReusableAfterBacktrackingStackLimit(t *testing.T) {
61 re := MustCompile(`x|(?:^){100}`, OptionMaxBacktrackingStackSize(64))

Callers

nothing calls this directly

Calls 3

MustCompileFunction · 0.70
MatchStringMethod · 0.65

Tested by

no test coverage detected