mirror of https://github.com/stretchr/testify.git
Generate better comments for require package
The comments for the require package were just copied over from the assert package when generating the functions. This could lead to confusion because 1. The code-examples were showing examples using the assert package instead of the require package 2. The function-documentation was not mentioning that the functions were calling `t.FailNow()` which is some critical information when using this package.pull/1610/head
parent
1b4fca7679
commit
9326036bf5
|
@ -107,7 +107,9 @@ func parseTemplates() (*template.Template, *template.Template, error) {
|
|||
}
|
||||
funcTemplate = string(f)
|
||||
}
|
||||
tmpl, err := template.New("function").Parse(funcTemplate)
|
||||
tmpl, err := template.New("function").Funcs(template.FuncMap{
|
||||
"replace": strings.ReplaceAll,
|
||||
}).Parse(funcTemplate)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,5 @@
|
|||
{{.Comment}}
|
||||
{{ replace .Comment "assert." "require."}}
|
||||
// Instead of returning a boolean result this function calls `t.FailNow()` on failure.
|
||||
func {{.DocInfo.Name}}(t TestingT, {{.Params}}) {
|
||||
if h, ok := t.(tHelper); ok { h.Helper() }
|
||||
if assert.{{.DocInfo.Name}}(t, {{.ForwardedParams}}) { return }
|
||||
|
|
Loading…
Reference in New Issue