Regexp asserts that a specified regexp matches a string. assert.Regexp(t, regexp.MustCompile("start"), "it's starting") assert.Regexp(t, "start...$", "it's not starting")
(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{})
| 1632 | // assert.Regexp(t, regexp.MustCompile("start"), "it's starting") |
| 1633 | // assert.Regexp(t, "start...$", "it's not starting") |
| 1634 | func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool { |
| 1635 | if h, ok := t.(tHelper); ok { |
| 1636 | h.Helper() |
| 1637 | } |
| 1638 | |
| 1639 | match := matchRegexp(rx, str) |
| 1640 | |
| 1641 | if !match { |
| 1642 | Fail(t, fmt.Sprintf("Expect \"%v\" to match \"%v\"", str, rx), msgAndArgs...) |
| 1643 | } |
| 1644 | |
| 1645 | return match |
| 1646 | } |
| 1647 | |
| 1648 | // NotRegexp asserts that a specified regexp does not match a string. |
| 1649 | // |
searching dependent graphs…