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

Function matchInOrder

browsertests/browser_test.go:160–178  ·  view source on GitHub ↗

matchInOrder is a chromedp.Action that fetches the text of the first node that matched query and checks that the supplied sequence of strings occur in order in the text.

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

Source from the content-addressed store, hash-verified

158// node that matched query and checks that the supplied sequence of
159// strings occur in order in the text.
160func matchInOrder(t *testing.T, query string, sequence ...string) chromedp.ActionFunc {
161 return func(ctx context.Context) error {
162 var value string
163 err := chromedp.Text(query, &value, chromedp.ByQuery).Do(ctx)
164 if err != nil {
165 return fmt.Errorf("text %s: %v", query, err)
166 }
167 t.Logf("text %s:\n%s", query, value)
168 remaining := value
169 for _, s := range sequence {
170 pos := strings.Index(remaining, s)
171 if pos < 0 {
172 return fmt.Errorf("%s: did not find %q in expected order %v in\n%s", query, s, sequence, value)
173 }
174 remaining = remaining[pos+len(s):]
175 }
176 return nil
177 }
178}
179
180// eval runs the specified javascript in the browser. The javascript must
181// return an [][]any, where each of the []any starts with either "LOG" or

Callers 1

TestTopTableFunction · 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…