CheckRegexpEqual checks that the value is matched by some regular expression.
(val, regexs string)
| 167 | // CheckRegexpEqual checks that the value is matched by some regular |
| 168 | // expression. |
| 169 | func (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 | |
| 181 | func (t *T) failWithf(failTest bool, format string, args ...interface{}) { |
| 182 | t.Helper() |