github.com/RevenueMonster/sqlike@v1.0.6/jsonb/errors_test.go (about) 1 package jsonb 2 3 import ( 4 "reflect" 5 "testing" 6 7 "github.com/stretchr/testify/require" 8 ) 9 10 func TestError(t *testing.T) { 11 { 12 err := ErrInvalidJSON{callback: "funcName", message: "error"} 13 require.Equal(t, "jsonb.funcName: error", err.Error()) 14 } 15 16 { 17 err := ErrNoEncoder{} 18 require.Equal(t, "no encoder for <nil>", err.Error()) 19 } 20 21 { 22 err := ErrNoEncoder{Type: reflect.TypeOf("")} 23 require.Equal(t, "no encoder for string", err.Error()) 24 } 25 26 { 27 err := ErrNoDecoder{} 28 require.Equal(t, "no decoder for <nil>", err.Error()) 29 } 30 31 { 32 err := ErrNoDecoder{Type: reflect.TypeOf(int(10))} 33 require.Equal(t, "no decoder for int", err.Error()) 34 } 35 }