refactor: move task, error and testing utils to separte repo; apply gofumpt

This commit is contained in:
yusing
2025-09-27 13:41:50 +08:00
parent 5043ef778f
commit 6776f20332
203 changed files with 696 additions and 2800 deletions

View File

@@ -4,8 +4,8 @@ import (
"strconv"
"testing"
"github.com/yusing/godoxy/internal/gperr"
. "github.com/yusing/godoxy/internal/utils/testing"
gperr "github.com/yusing/goutils/errs"
expect "github.com/yusing/goutils/testing"
)
func TestParser(t *testing.T) {
@@ -68,15 +68,15 @@ func TestParser(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
subject, args, err := parse(tt.input)
if tt.wantErr != nil {
ExpectError(t, tt.wantErr, err)
expect.ErrorIs(t, tt.wantErr, err)
return
}
// t.Log(subject, args, err)
ExpectNoError(t, err)
ExpectEqual(t, subject, tt.subject)
ExpectEqual(t, len(args), len(tt.args))
expect.NoError(t, err)
expect.Equal(t, subject, tt.subject)
expect.Equal(t, len(args), len(tt.args))
for i, arg := range args {
ExpectEqual(t, arg, tt.args[i])
expect.Equal(t, arg, tt.args[i])
}
})
}
@@ -89,7 +89,7 @@ func TestParser(t *testing.T) {
for i, test := range tests {
t.Run(strconv.Itoa(i), func(t *testing.T) {
_, _, err := parse(test)
ExpectError(t, ErrUnterminatedQuotes, err)
expect.ErrorIs(t, ErrUnterminatedQuotes, err)
})
}
})