MCPcopy Index your code
hub / github.com/cockroachdb/errors / CheckRegexpEqual

Method CheckRegexpEqual

testutils/simplecheck.go:169–179  ·  view source on GitHub ↗

CheckRegexpEqual checks that the value is matched by some regular expression.

(val, regexs string)

Source from the content-addressed store, hash-verified

167// CheckRegexpEqual checks that the value is matched by some regular
168// expression.
169func (t *T) CheckRegexpEqual(val, regexs string) {
170 t.Helper()
171 m, err := regexp.MatchString(regexs, val)
172 if err != nil {
173 t.Fatalf("error compiling regular expression: %+v", err)
174 }
175 if !m {
176 t.failWithf(false, "values does not match regular expression\ngot: %q\nexpected to match regexp:\n%s",
177 pretty.Formatter(val), pretty.Formatter(regexs))
178 }
179}
180
181func (t *T) failWithf(failTest bool, format string, args ...interface{}) {
182 t.Helper()

Callers 2

TestReportFunction · 0.95
TestAssertFunction · 0.80

Calls 1

failWithfMethod · 0.95

Tested by 2

TestReportFunction · 0.76
TestAssertFunction · 0.64