mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-21 17:00:01 +02:00
enable linter testifylint on v7 (#4572)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4572 Co-authored-by: TheFox0x7 <thefox0x7@gmail.com> Co-committed-by: TheFox0x7 <thefox0x7@gmail.com>
This commit is contained in:
parent
c47bdf436b
commit
072dd9f8bc
494 changed files with 4897 additions and 4554 deletions
|
@ -10,6 +10,7 @@ import (
|
|||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestDict(t *testing.T) {
|
||||
|
@ -27,9 +28,8 @@ func TestDict(t *testing.T) {
|
|||
|
||||
for _, c := range cases {
|
||||
got, err := dict(c.args...)
|
||||
if assert.NoError(t, err) {
|
||||
assert.EqualValues(t, c.want, got)
|
||||
}
|
||||
require.NoError(t, err)
|
||||
assert.EqualValues(t, c.want, got)
|
||||
}
|
||||
|
||||
bads := []struct {
|
||||
|
@ -41,7 +41,7 @@ func TestDict(t *testing.T) {
|
|||
}
|
||||
for _, c := range bads {
|
||||
_, err := dict(c.args...)
|
||||
assert.Error(t, err)
|
||||
require.Error(t, err)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ func TestUtils(t *testing.T) {
|
|||
tmpl.Funcs(template.FuncMap{"SliceUtils": NewSliceUtils, "StringUtils": NewStringUtils})
|
||||
template.Must(tmpl.Parse(code))
|
||||
w := &strings.Builder{}
|
||||
assert.NoError(t, tmpl.Execute(w, data))
|
||||
require.NoError(t, tmpl.Execute(w, data))
|
||||
return w.String()
|
||||
}
|
||||
|
||||
|
@ -75,5 +75,5 @@ func TestUtils(t *testing.T) {
|
|||
template.Must(tmpl.Parse("{{SliceUtils.Contains .Slice .Value}}"))
|
||||
// error is like this: `template: test:1:12: executing "test" at <SliceUtils.Contains>: error calling Contains: ...`
|
||||
err := tmpl.Execute(io.Discard, map[string]any{"Slice": struct{}{}})
|
||||
assert.ErrorContains(t, err, "invalid type, expected slice or array")
|
||||
require.ErrorContains(t, err, "invalid type, expected slice or array")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue