Skip to content

Commit

Permalink
💚 ci: math, str - fix some convert tests error
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Dec 9, 2023
1 parent dd72232 commit 4275d2c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion mathutil/convert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"testing"
"time"

"github.com/gookit/goutil/internal/comfunc"
"github.com/gookit/goutil/mathutil"
"github.com/gookit/goutil/testutil/assert"
)
Expand Down Expand Up @@ -51,7 +52,7 @@ func TestWithUserConvFn(t *testing.T) {
is.Eq(2.0, f)

// to string
s, err := mathutil.ToStringWith(in, mathutil.WithUserConvFn(func(v any) (string, error) {
s, err := mathutil.ToStringWith(in, comfunc.WithUserConvFn(func(v any) (string, error) {
return "2", nil
}))
is.NoErr(err)
Expand Down
4 changes: 2 additions & 2 deletions strutil/convert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func TestToString(t *testing.T) {
is.Eq("true", str)

_, err = strutil.String(nil)
is.Err(err)
is.NoErr(err)

_, err = strutil.String([]string{"a"})
is.Err(err)
Expand All @@ -128,7 +128,7 @@ func TestToString(t *testing.T) {
str = strutil.QuietString(nil)
is.Eq("", str)

str = strutil.StringOrDefault(nil, "default")
str = strutil.StringOrDefault([]string{"a"}, "default")
is.Eq("default", str)
str = strutil.StringOrDefault("value", "default")
is.Eq("value", str)
Expand Down

0 comments on commit 4275d2c

Please sign in to comment.