Skip to content
Merged
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
6 changes: 3 additions & 3 deletions _codegen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@ func parseTemplates() (*template.Template, *template.Template, error) {
}
funcTemplate = string(f)
}
tmpl, err := template.New("function").Funcs(template.FuncMap{
"replace": strings.ReplaceAll,
}).Parse(funcTemplate)
tmpl, err := template.New("function").Parse(funcTemplate)
if err != nil {
return nil, nil, err
}
Expand Down Expand Up @@ -331,6 +329,8 @@ func requireComment(comment string) string {

func (f *testFunc) CommentRequire() string {
comment := strings.ReplaceAll(f.DocInfo.Doc, "assert.", "require.")
// Preserve assert.CollectT, even in package 'require'
comment = strings.ReplaceAll(comment, "require.CollectT", "assert.CollectT")
return requireComment(comment)
}

Expand Down
4 changes: 2 additions & 2 deletions require/require.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ func Eventually(t TestingT, condition func() bool, waitFor time.Duration, tick t
// time.Sleep(8*time.Second)
// externalValue = true
// }()
// require.EventuallyWithT(t, func(c *require.CollectT) {
// require.EventuallyWithT(t, func(c *assert.CollectT) {
// // add assertions as needed; any assertion failure will fail the current tick
// require.True(c, externalValue, "expected 'externalValue' to be true")
// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false")
Expand Down Expand Up @@ -457,7 +457,7 @@ func EventuallyWithT(t TestingT, condition func(collect *assert.CollectT), waitF
// time.Sleep(8*time.Second)
// externalValue = true
// }()
// require.EventuallyWithTf(t, func(c *require.CollectT, "error message %s", "formatted") {
// require.EventuallyWithTf(t, func(c *assert.CollectT, "error message %s", "formatted") {
// // add assertions as needed; any assertion failure will fail the current tick
// require.True(c, externalValue, "expected 'externalValue' to be true")
// }, 10*time.Second, 1*time.Second, "external state has not changed to 'true'; still false")
Expand Down