diff --git a/core/core_test.go b/core/core_test.go index f251c78..0953562 100644 --- a/core/core_test.go +++ b/core/core_test.go @@ -226,7 +226,7 @@ func TestCore_Decode_ErrUnsupporetedType(t *testing.T) { co, err := New(Cursor{}) assert.NoError(t, err) got, err := co.Decode(r) - assert.ErrorIs(t, err, internal.ErrUnsupportedType) + assert.ErrorIs(t, err, owl.ErrUnsupportedType) assert.ErrorContains(t, err, "ObjectID") assert.Nil(t, got) }() @@ -244,7 +244,7 @@ func TestCore_Decode_ErrUnsupporetedType(t *testing.T) { co, err := New(Payload{}) assert.NoError(t, err) got, err := co.Decode(r) - assert.ErrorIs(t, err, internal.ErrUnsupportedType) + assert.ErrorIs(t, err, owl.ErrUnsupportedType) assert.ErrorContains(t, err, "ObjectID") assert.Nil(t, got) }() diff --git a/core/query_test.go b/core/query_test.go index 65c1f45..dc37c8a 100644 --- a/core/query_test.go +++ b/core/query_test.go @@ -6,8 +6,8 @@ import ( "net/url" "testing" - "github.com/ggicci/httpin/internal" "github.com/stretchr/testify/assert" + "github.com/ggicci/owl" ) func TestDirectiveQuery_Decode(t *testing.T) { @@ -106,7 +106,7 @@ func TestDirectiveQuery_NewRequest_ErrUnsupportedType(t *testing.T) { co, err := New(SearchQuery{}) assert.NoError(t, err) _, err = co.NewRequest("GET", "/pets", &SearchQuery{}) - assert.ErrorIs(t, err, internal.ErrUnsupportedType) + assert.ErrorIs(t, err, owl.ErrUnsupportedType) } // See hybridcoder_test.go for more details. diff --git a/core/stringable_test.go b/core/stringable_test.go index 48f4b4f..27a906e 100644 --- a/core/stringable_test.go +++ b/core/stringable_test.go @@ -9,6 +9,7 @@ import ( "github.com/ggicci/httpin/internal" "github.com/ggicci/httpin/patch" "github.com/stretchr/testify/assert" + "github.com/ggicci/owl" ) type Point2D struct { @@ -234,7 +235,7 @@ func testAssignString(t *testing.T, rv reflect.Value, value string) { func testNewStringableErrUnsupported(t *testing.T, rv reflect.Value) { s, err := NewStringable(rv, nil) - assert.ErrorIs(t, err, internal.ErrUnsupportedType) + assert.ErrorIs(t, err, owl.ErrUnsupportedType) assert.Nil(t, s) } diff --git a/internal/stringable.go b/internal/stringable.go index 852549d..1300cda 100644 --- a/internal/stringable.go +++ b/internal/stringable.go @@ -9,11 +9,11 @@ import ( "strconv" "strings" "time" + "github.com/ggicci/owl" ) var ( - ErrUnsupportedType = errors.New("unsupported type") - ErrTypeMismatch = errors.New("type mismatch") + ErrTypeMismatch = errors.New("type mismatch") builtinStringableAdaptors = make(map[reflect.Type]AnyStringableAdaptor) ) @@ -380,5 +380,5 @@ func (bs *ByteSlice) FromString(s string) error { } func UnsupportedType(rt reflect.Type) error { - return fmt.Errorf("%w: %v", ErrUnsupportedType, rt) + return fmt.Errorf("%w: %v", owl.ErrUnsupportedType, rt) } diff --git a/internal/stringable_test.go b/internal/stringable_test.go index ac4ebf6..8072fa8 100644 --- a/internal/stringable_test.go +++ b/internal/stringable_test.go @@ -7,6 +7,7 @@ import ( "time" "github.com/stretchr/testify/assert" + "github.com/ggicci/owl" ) func TestNewStringable_string(t *testing.T) { @@ -156,7 +157,7 @@ func TestNewStringable_ErrUnsupportedType(t *testing.T) { }) rvStructPointer := reflect.ValueOf(&s) sv, err := NewStringable(rvStructPointer) - assert.ErrorIs(t, err, ErrUnsupportedType) + assert.ErrorIs(t, err, owl.ErrUnsupportedType) assert.Nil(t, sv) }