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{})
| 1724 | // assert.Regexp(t, regexp.MustCompile("start"), "it's starting") |
| 1725 | // assert.Regexp(t, "start...$", "it's not starting") |
| 1726 | func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool { |
| 1727 | if h, ok := t.(tHelper); ok { |
| 1728 | h.Helper() |
| 1729 | } |
| 1730 | |
| 1731 | match := matchRegexp(rx, str) |
| 1732 | |
| 1733 | if !match { |
| 1734 | Fail(t, fmt.Sprintf("Expect \"%v\" to match \"%v\"", str, rx), msgAndArgs...) |
| 1735 | } |
| 1736 | |
| 1737 | return match |
| 1738 | } |
| 1739 | |
| 1740 | // NotRegexp asserts that a specified regexp does not match a string. |
| 1741 | // |