MCPcopy Create free account
hub / github.com/google/pprof / matchRegexp

Function matchRegexp

browsertests/browser_test.go:138–155  ·  view source on GitHub ↗

matchRegexp is a chromedp.Action that fetches the text of the first node that matched query and checks that the text matches regexp re.

(t *testing.T, query, re string)

Source from the content-addressed store, hash-verified

136// matchRegexp is a chromedp.Action that fetches the text of the first
137// node that matched query and checks that the text matches regexp re.
138func matchRegexp(t *testing.T, query, re string) chromedp.ActionFunc {
139 return func(ctx context.Context) error {
140 var value string
141 err := chromedp.Text(query, &value, chromedp.ByQuery).Do(ctx)
142 if err != nil {
143 return fmt.Errorf("text %s: %v", query, err)
144 }
145 t.Logf("text %s:\n%s", query, value)
146 m, err := regexp.MatchString(re, value)
147 if err != nil {
148 return err
149 }
150 if !m {
151 return fmt.Errorf("%s: did not find %q in\n%s", query, re, value)
152 }
153 return nil
154 }
155}
156
157// matchInOrder is a chromedp.Action that fetches the text of the first
158// node that matched query and checks that the supplied sequence of

Callers 2

TestTopTableFunction · 0.85
TestSourceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…