Skip to content

Commit e72b029

Browse files
n9netalesboyan-soubachov
authored andcommitted
new regex
1 parent d4e7ca1 commit e72b029

File tree

5 files changed

+37
-37
lines changed

5 files changed

+37
-37
lines changed

_codegen/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ func (f *testFunc) CommentFormat() string {
287287
search := fmt.Sprintf("%s", f.DocInfo.Name)
288288
replace := fmt.Sprintf("%sf", f.DocInfo.Name)
289289
comment := strings.Replace(f.Comment(), search, replace, -1)
290-
exp := regexp.MustCompile(replace + `\(((\(\)|[^)])+)\)`)
290+
exp := regexp.MustCompile(replace + `\(((\(\)|[^\n])+)\)`)
291291
return exp.ReplaceAllString(comment, replace+`($1, "error message %s", "formatted")`)
292292
}
293293

assert/assertion_format.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func EqualErrorf(t TestingT, theError error, errString string, msg string, args
9494
// EqualValuesf asserts that two objects are equal or convertable to the same types
9595
// and equal.
9696
//
97-
// assert.EqualValuesf(t, uint32(123, "error message %s", "formatted"), int32(123))
97+
// assert.EqualValuesf(t, uint32(123), int32(123), "error message %s", "formatted")
9898
func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
9999
if h, ok := t.(tHelper); ok {
100100
h.Helper()
@@ -128,7 +128,7 @@ func Eventuallyf(t TestingT, condition func() bool, waitFor time.Duration, tick
128128

129129
// Exactlyf asserts that two objects are equal in value and type.
130130
//
131-
// assert.Exactlyf(t, int32(123, "error message %s", "formatted"), int64(123))
131+
// assert.Exactlyf(t, int32(123), int64(123), "error message %s", "formatted")
132132
func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
133133
if h, ok := t.(tHelper); ok {
134134
h.Helper()
@@ -174,7 +174,7 @@ func FileExistsf(t TestingT, path string, msg string, args ...interface{}) bool
174174
// Greaterf asserts that the first element is greater than the second
175175
//
176176
// assert.Greaterf(t, 2, 1, "error message %s", "formatted")
177-
// assert.Greaterf(t, float64(2, "error message %s", "formatted"), float64(1))
177+
// assert.Greaterf(t, float64(2), float64(1), "error message %s", "formatted")
178178
// assert.Greaterf(t, "b", "a", "error message %s", "formatted")
179179
func Greaterf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
180180
if h, ok := t.(tHelper); ok {
@@ -226,7 +226,7 @@ func HTTPBodyNotContainsf(t TestingT, handler http.HandlerFunc, method string, u
226226
//
227227
// assert.HTTPErrorf(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
228228
//
229-
// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
229+
// Returns whether the assertion was successful (true) or not (false).
230230
func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
231231
if h, ok := t.(tHelper); ok {
232232
h.Helper()
@@ -238,7 +238,7 @@ func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string,
238238
//
239239
// assert.HTTPRedirectf(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
240240
//
241-
// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
241+
// Returns whether the assertion was successful (true) or not (false).
242242
func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
243243
if h, ok := t.(tHelper); ok {
244244
h.Helper()
@@ -272,7 +272,7 @@ func HTTPSuccessf(t TestingT, handler http.HandlerFunc, method string, url strin
272272

273273
// Implementsf asserts that an object is implemented by the specified interface.
274274
//
275-
// assert.Implementsf(t, (*MyInterface, "error message %s", "formatted")(nil), new(MyObject))
275+
// assert.Implementsf(t, (*MyInterface)(nil), new(MyObject), "error message %s", "formatted")
276276
func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool {
277277
if h, ok := t.(tHelper); ok {
278278
h.Helper()
@@ -354,7 +354,7 @@ func Lenf(t TestingT, object interface{}, length int, msg string, args ...interf
354354
// Lessf asserts that the first element is less than the second
355355
//
356356
// assert.Lessf(t, 1, 2, "error message %s", "formatted")
357-
// assert.Lessf(t, float64(1, "error message %s", "formatted"), float64(2))
357+
// assert.Lessf(t, float64(1), float64(2), "error message %s", "formatted")
358358
// assert.Lessf(t, "a", "b", "error message %s", "formatted")
359359
func Lessf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
360360
if h, ok := t.(tHelper); ok {
@@ -489,7 +489,7 @@ func NotPanicsf(t TestingT, f PanicTestFunc, msg string, args ...interface{}) bo
489489

490490
// NotRegexpf asserts that a specified regexp does not match a string.
491491
//
492-
// assert.NotRegexpf(t, regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting")
492+
// assert.NotRegexpf(t, regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted")
493493
// assert.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted")
494494
func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool {
495495
if h, ok := t.(tHelper); ok {
@@ -565,7 +565,7 @@ func PanicsWithValuef(t TestingT, expected interface{}, f PanicTestFunc, msg str
565565

566566
// Regexpf asserts that a specified regexp matches a string.
567567
//
568-
// assert.Regexpf(t, regexp.MustCompile("start", "error message %s", "formatted"), "it's starting")
568+
// assert.Regexpf(t, regexp.MustCompile("start"), "it's starting", "error message %s", "formatted")
569569
// assert.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted")
570570
func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) bool {
571571
if h, ok := t.(tHelper); ok {

assert/assertion_forward.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAn
170170
// EqualValuesf asserts that two objects are equal or convertable to the same types
171171
// and equal.
172172
//
173-
// a.EqualValuesf(uint32(123, "error message %s", "formatted"), int32(123))
173+
// a.EqualValuesf(uint32(123), int32(123), "error message %s", "formatted")
174174
func (a *Assertions) EqualValuesf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
175175
if h, ok := a.t.(tHelper); ok {
176176
h.Helper()
@@ -252,7 +252,7 @@ func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArg
252252

253253
// Exactlyf asserts that two objects are equal in value and type.
254254
//
255-
// a.Exactlyf(int32(123, "error message %s", "formatted"), int64(123))
255+
// a.Exactlyf(int32(123), int64(123), "error message %s", "formatted")
256256
func (a *Assertions) Exactlyf(expected interface{}, actual interface{}, msg string, args ...interface{}) bool {
257257
if h, ok := a.t.(tHelper); ok {
258258
h.Helper()
@@ -371,7 +371,7 @@ func (a *Assertions) GreaterOrEqualf(e1 interface{}, e2 interface{}, msg string,
371371
// Greaterf asserts that the first element is greater than the second
372372
//
373373
// a.Greaterf(2, 1, "error message %s", "formatted")
374-
// a.Greaterf(float64(2, "error message %s", "formatted"), float64(1))
374+
// a.Greaterf(float64(2), float64(1), "error message %s", "formatted")
375375
// a.Greaterf("b", "a", "error message %s", "formatted")
376376
func (a *Assertions) Greaterf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
377377
if h, ok := a.t.(tHelper); ok {
@@ -448,7 +448,7 @@ func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url stri
448448
//
449449
// a.HTTPErrorf(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
450450
//
451-
// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
451+
// Returns whether the assertion was successful (true) or not (false).
452452
func (a *Assertions) HTTPErrorf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
453453
if h, ok := a.t.(tHelper); ok {
454454
h.Helper()
@@ -472,7 +472,7 @@ func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url s
472472
//
473473
// a.HTTPRedirectf(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
474474
//
475-
// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
475+
// Returns whether the assertion was successful (true) or not (false).
476476
func (a *Assertions) HTTPRedirectf(handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) bool {
477477
if h, ok := a.t.(tHelper); ok {
478478
h.Helper()
@@ -540,7 +540,7 @@ func (a *Assertions) Implements(interfaceObject interface{}, object interface{},
540540

541541
// Implementsf asserts that an object is implemented by the specified interface.
542542
//
543-
// a.Implementsf((*MyInterface, "error message %s", "formatted")(nil), new(MyObject))
543+
// a.Implementsf((*MyInterface)(nil), new(MyObject), "error message %s", "formatted")
544544
func (a *Assertions) Implementsf(interfaceObject interface{}, object interface{}, msg string, args ...interface{}) bool {
545545
if h, ok := a.t.(tHelper); ok {
546546
h.Helper()
@@ -731,7 +731,7 @@ func (a *Assertions) LessOrEqualf(e1 interface{}, e2 interface{}, msg string, ar
731731
// Lessf asserts that the first element is less than the second
732732
//
733733
// a.Lessf(1, 2, "error message %s", "formatted")
734-
// a.Lessf(float64(1, "error message %s", "formatted"), float64(2))
734+
// a.Lessf(float64(1), float64(2), "error message %s", "formatted")
735735
// a.Lessf("a", "b", "error message %s", "formatted")
736736
func (a *Assertions) Lessf(e1 interface{}, e2 interface{}, msg string, args ...interface{}) bool {
737737
if h, ok := a.t.(tHelper); ok {
@@ -975,7 +975,7 @@ func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...in
975975

976976
// NotRegexpf asserts that a specified regexp does not match a string.
977977
//
978-
// a.NotRegexpf(regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting")
978+
// a.NotRegexpf(regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted")
979979
// a.NotRegexpf("^start", "it's not starting", "error message %s", "formatted")
980980
func (a *Assertions) NotRegexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool {
981981
if h, ok := a.t.(tHelper); ok {
@@ -1127,7 +1127,7 @@ func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...inter
11271127

11281128
// Regexpf asserts that a specified regexp matches a string.
11291129
//
1130-
// a.Regexpf(regexp.MustCompile("start", "error message %s", "formatted"), "it's starting")
1130+
// a.Regexpf(regexp.MustCompile("start"), "it's starting", "error message %s", "formatted")
11311131
// a.Regexpf("start...$", "it's not starting", "error message %s", "formatted")
11321132
func (a *Assertions) Regexpf(rx interface{}, str interface{}, msg string, args ...interface{}) bool {
11331133
if h, ok := a.t.(tHelper); ok {

require/require.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ func EqualValues(t TestingT, expected interface{}, actual interface{}, msgAndArg
213213
// EqualValuesf asserts that two objects are equal or convertable to the same types
214214
// and equal.
215215
//
216-
// assert.EqualValuesf(t, uint32(123, "error message %s", "formatted"), int32(123))
216+
// assert.EqualValuesf(t, uint32(123), int32(123), "error message %s", "formatted")
217217
func EqualValuesf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
218218
if h, ok := t.(tHelper); ok {
219219
h.Helper()
@@ -316,7 +316,7 @@ func Exactly(t TestingT, expected interface{}, actual interface{}, msgAndArgs ..
316316

317317
// Exactlyf asserts that two objects are equal in value and type.
318318
//
319-
// assert.Exactlyf(t, int32(123, "error message %s", "formatted"), int64(123))
319+
// assert.Exactlyf(t, int32(123), int64(123), "error message %s", "formatted")
320320
func Exactlyf(t TestingT, expected interface{}, actual interface{}, msg string, args ...interface{}) {
321321
if h, ok := t.(tHelper); ok {
322322
h.Helper()
@@ -471,7 +471,7 @@ func GreaterOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, arg
471471
// Greaterf asserts that the first element is greater than the second
472472
//
473473
// assert.Greaterf(t, 2, 1, "error message %s", "formatted")
474-
// assert.Greaterf(t, float64(2, "error message %s", "formatted"), float64(1))
474+
// assert.Greaterf(t, float64(2), float64(1), "error message %s", "formatted")
475475
// assert.Greaterf(t, "b", "a", "error message %s", "formatted")
476476
func Greaterf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) {
477477
if h, ok := t.(tHelper); ok {
@@ -566,7 +566,7 @@ func HTTPError(t TestingT, handler http.HandlerFunc, method string, url string,
566566
//
567567
// assert.HTTPErrorf(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}}
568568
//
569-
// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
569+
// Returns whether the assertion was successful (true) or not (false).
570570
func HTTPErrorf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {
571571
if h, ok := t.(tHelper); ok {
572572
h.Helper()
@@ -596,7 +596,7 @@ func HTTPRedirect(t TestingT, handler http.HandlerFunc, method string, url strin
596596
//
597597
// assert.HTTPRedirectf(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}}
598598
//
599-
// Returns whether the assertion was successful (true, "error message %s", "formatted") or not (false).
599+
// Returns whether the assertion was successful (true) or not (false).
600600
func HTTPRedirectf(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, msg string, args ...interface{}) {
601601
if h, ok := t.(tHelper); ok {
602602
h.Helper()
@@ -682,7 +682,7 @@ func Implements(t TestingT, interfaceObject interface{}, object interface{}, msg
682682

683683
// Implementsf asserts that an object is implemented by the specified interface.
684684
//
685-
// assert.Implementsf(t, (*MyInterface, "error message %s", "formatted")(nil), new(MyObject))
685+
// assert.Implementsf(t, (*MyInterface)(nil), new(MyObject), "error message %s", "formatted")
686686
func Implementsf(t TestingT, interfaceObject interface{}, object interface{}, msg string, args ...interface{}) {
687687
if h, ok := t.(tHelper); ok {
688688
h.Helper()
@@ -933,7 +933,7 @@ func LessOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args .
933933
// Lessf asserts that the first element is less than the second
934934
//
935935
// assert.Lessf(t, 1, 2, "error message %s", "formatted")
936-
// assert.Lessf(t, float64(1, "error message %s", "formatted"), float64(2))
936+
// assert.Lessf(t, float64(1), float64(2), "error message %s", "formatted")
937937
// assert.Lessf(t, "a", "b", "error message %s", "formatted")
938938
func Lessf(t TestingT, e1 interface{}, e2 interface{}, msg string, args ...interface{}) {
939939
if h, ok := t.(tHelper); ok {
@@ -1243,7 +1243,7 @@ func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interf
12431243

12441244
// NotRegexpf asserts that a specified regexp does not match a string.
12451245
//
1246-
// assert.NotRegexpf(t, regexp.MustCompile("starts", "error message %s", "formatted"), "it's starting")
1246+
// assert.NotRegexpf(t, regexp.MustCompile("starts"), "it's starting", "error message %s", "formatted")
12471247
// assert.NotRegexpf(t, "^start", "it's not starting", "error message %s", "formatted")
12481248
func NotRegexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) {
12491249
if h, ok := t.(tHelper); ok {
@@ -1437,7 +1437,7 @@ func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface
14371437

14381438
// Regexpf asserts that a specified regexp matches a string.
14391439
//
1440-
// assert.Regexpf(t, regexp.MustCompile("start", "error message %s", "formatted"), "it's starting")
1440+
// assert.Regexpf(t, regexp.MustCompile("start"), "it's starting", "error message %s", "formatted")
14411441
// assert.Regexpf(t, "start...$", "it's not starting", "error message %s", "formatted")
14421442
func Regexpf(t TestingT, rx interface{}, str interface{}, msg string, args ...interface{}) {
14431443
if h, ok := t.(tHelper); ok {

0 commit comments

Comments
 (0)