Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions assert/assertion_format.go
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,11 @@ func NotPanicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bo
//
// assert.NotRegexpf(t, regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted")
// assert.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted")
//
// The rx argument may be a *regexp.Regexp, which is used directly, or any
// other value, which is converted to a string with fmt.Sprint and compiled
// with regexp.MustCompile. A non-*regexp.Regexp value that is not a valid
// regular expression therefore causes a panic.
func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
Expand Down Expand Up @@ -783,6 +788,11 @@ func Positivef(t TestingT, e interface{}, msg string, args ...interface{}) bool
//
// assert.Regexpf(t, regexp.MustCompile("start"), "it's starting", "error message %s", "formatted")
// assert.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted")
//
// The rx argument may be a *regexp.Regexpf, which is used directly, or any
// other value, which is converted to a string with fmt.Sprint and compiled
// with regexp.MustCompile. A non-*regexp.Regexpf value that is not a valid
// regular expression therefore causes a panic.
func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
Expand Down
20 changes: 20 additions & 0 deletions assert/assertion_forward.go
Original file line number Diff line number Diff line change
Expand Up @@ -1370,6 +1370,11 @@ func (a *Assertions) NotPanicsf(f PanicTestFunc, msg string, args ...interface{}
//
// a.NotRegexp(regexp.MustCompile("starts"), "it's starting")
// a.NotRegexp("^start", "it's not starting")
//
// The rx argument may be a *regexp.Regexp, which is used directly, or any
// other value, which is converted to a string with fmt.Sprint and compiled
// with regexp.MustCompile. A non-*regexp.Regexp value that is not a valid
// regular expression therefore causes a panic.
func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
Expand All @@ -1381,6 +1386,11 @@ func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...in
//
// a.NotRegexpf(regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted")
// a.NotRegexpf("^start", "it's not starting", "error message %s", "formatted")
//
// The rx argument may be a *regexp.Regexp, which is used directly, or any
// other value, which is converted to a string with fmt.Sprint and compiled
// with regexp.MustCompile. A non-*regexp.Regexp value that is not a valid
// regular expression therefore causes a panic.
func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
Expand Down Expand Up @@ -1554,6 +1564,11 @@ func (a *Assertions) Positivef(e interface{}, msg string, args ...interface{}) b
//
// a.Regexp(regexp.MustCompile("start"), "it's starting")
// a.Regexp("start...$", "it's not starting")
//
// The rx argument may be a *regexp.Regexp, which is used directly, or any
// other value, which is converted to a string with fmt.Sprint and compiled
// with regexp.MustCompile. A non-*regexp.Regexp value that is not a valid
// regular expression therefore causes a panic.
func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
Expand All @@ -1565,6 +1580,11 @@ func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...inter
//
// a.Regexpf(regexp.MustCompile("start"), "it's starting", "error message %s", "formatted")
// a.Regexpf("start...$", "it's not starting", "error message %s", "formatted")
//
// The rx argument may be a *regexp.Regexpf, which is used directly, or any
// other value, which is converted to a string with fmt.Sprint and compiled
// with regexp.MustCompile. A non-*regexp.Regexpf value that is not a valid
// regular expression therefore causes a panic.
func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool {
if h, ok := a.t.(tHelper); ok {
h.Helper()
Expand Down
10 changes: 10 additions & 0 deletions assert/assertions.go
Original file line number Diff line number Diff line change
Expand Up @@ -1730,6 +1730,11 @@ func matchRegexp(rx interface{}, str interface{}) bool {
//
// assert.Regexp(t, regexp.MustCompile("start"), "it's starting")
// assert.Regexp(t, "start...$", "it's not starting")
//
// The rx argument may be a *regexp.Regexp, which is used directly, or any
// other value, which is converted to a string with fmt.Sprint and compiled
// with regexp.MustCompile. A non-*regexp.Regexp value that is not a valid
// regular expression therefore causes a panic.
func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
Expand All @@ -1748,6 +1753,11 @@ func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface
//
// assert.NotRegexp(t, regexp.MustCompile("starts"), "it's starting")
// assert.NotRegexp(t, "^start", "it's not starting")
//
// The rx argument may be a *regexp.Regexp, which is used directly, or any
// other value, which is converted to a string with fmt.Sprint and compiled
// with regexp.MustCompile. A non-*regexp.Regexp value that is not a valid
// regular expression therefore causes a panic.
func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool {
if h, ok := t.(tHelper); ok {
h.Helper()
Expand Down
20 changes: 20 additions & 0 deletions require/require.go
Original file line number Diff line number Diff line change
Expand Up @@ -1703,6 +1703,11 @@ func NotPanicsf(t TestingT, f assert.PanicTestFunc, msg string, args ...interfac
//
// require.NotRegexp(t, regexp.MustCompile("starts"), "it's starting")
// require.NotRegexp(t, "^start", "it's not starting")
//
// The rx argument may be a *regexp.Regexp, which is used directly, or any
// other value, which is converted to a string with fmt.Sprint and compiled
// with regexp.MustCompile. A non-*regexp.Regexp value that is not a valid
// regular expression therefore causes a panic.
func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) {
if h, ok := t.(tHelper); ok {
h.Helper()
Expand All @@ -1717,6 +1722,11 @@ func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interf
//
// require.NotRegexpf(t, regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted")
// require.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted")
//
// The rx argument may be a *regexp.Regexp, which is used directly, or any
// other value, which is converted to a string with fmt.Sprint and compiled
// with regexp.MustCompile. A non-*regexp.Regexp value that is not a valid
// regular expression therefore causes a panic.
func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) {
if h, ok := t.(tHelper); ok {
h.Helper()
Expand Down Expand Up @@ -1935,6 +1945,11 @@ func Positivef(t TestingT, e interface{}, msg string, args ...interface{}) {
//
// require.Regexp(t, regexp.MustCompile("start"), "it's starting")
// require.Regexp(t, "start...$", "it's not starting")
//
// The rx argument may be a *regexp.Regexp, which is used directly, or any
// other value, which is converted to a string with fmt.Sprint and compiled
// with regexp.MustCompile. A non-*regexp.Regexp value that is not a valid
// regular expression therefore causes a panic.
func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) {
if h, ok := t.(tHelper); ok {
h.Helper()
Expand All @@ -1949,6 +1964,11 @@ func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface
//
// require.Regexpf(t, regexp.MustCompile("start"), "it's starting", "error message %s", "formatted")
// require.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted")
//
// The rx argument may be a *regexp.Regexpf, which is used directly, or any
// other value, which is converted to a string with fmt.Sprint and compiled
// with regexp.MustCompile. A non-*regexp.Regexpf value that is not a valid
// regular expression therefore causes a panic.
func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) {
if h, ok := t.(tHelper); ok {
h.Helper()
Expand Down
20 changes: 20 additions & 0 deletions require/require_forward.go
Original file line number Diff line number Diff line change
Expand Up @@ -1343,6 +1343,11 @@ func (a *Assertions) NotPanicsf(f assert.PanicTestFunc, msg string, args ...inte
//
// a.NotRegexp(regexp.MustCompile("starts"), "it's starting")
// a.NotRegexp("^start", "it's not starting")
//
// The rx argument may be a *regexp.Regexp, which is used directly, or any
// other value, which is converted to a string with fmt.Sprint and compiled
// with regexp.MustCompile. A non-*regexp.Regexp value that is not a valid
// regular expression therefore causes a panic.
func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) {
if h, ok := a.t.(tHelper); ok {
h.Helper()
Expand All @@ -1354,6 +1359,11 @@ func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...in
//
// a.NotRegexpf(regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted")
// a.NotRegexpf("^start", "it's not starting", "error message %s", "formatted")
//
// The rx argument may be a *regexp.Regexp, which is used directly, or any
// other value, which is converted to a string with fmt.Sprint and compiled
// with regexp.MustCompile. A non-*regexp.Regexp value that is not a valid
// regular expression therefore causes a panic.
func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) {
if h, ok := a.t.(tHelper); ok {
h.Helper()
Expand Down Expand Up @@ -1527,6 +1537,11 @@ func (a *Assertions) Positivef(e interface{}, msg string, args ...interface{}) {
//
// a.Regexp(regexp.MustCompile("start"), "it's starting")
// a.Regexp("start...$", "it's not starting")
//
// The rx argument may be a *regexp.Regexp, which is used directly, or any
// other value, which is converted to a string with fmt.Sprint and compiled
// with regexp.MustCompile. A non-*regexp.Regexp value that is not a valid
// regular expression therefore causes a panic.
func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) {
if h, ok := a.t.(tHelper); ok {
h.Helper()
Expand All @@ -1538,6 +1553,11 @@ func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...inter
//
// a.Regexpf(regexp.MustCompile("start"), "it's starting", "error message %s", "formatted")
// a.Regexpf("start...$", "it's not starting", "error message %s", "formatted")
//
// The rx argument may be a *regexp.Regexpf, which is used directly, or any
// other value, which is converted to a string with fmt.Sprint and compiled
// with regexp.MustCompile. A non-*regexp.Regexpf value that is not a valid
// regular expression therefore causes a panic.
func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) {
if h, ok := a.t.(tHelper); ok {
h.Helper()
Expand Down