go
/
misc
1
0
Fork 0

resolve broken test case

This commit is contained in:
Sangbum Kim 2022-03-21 22:25:55 +09:00
parent d5385fbb7f
commit 3ac04b0377
3 changed files with 10 additions and 10 deletions

View File

@ -63,7 +63,7 @@ func (d *RoundrobinDialer) resolveHost(ctx context.Context, network, connectAddr
}
if resolvedIPs, err = d.Dialer.Resolver.LookupIP(ctx, network, host); err != nil {
log.Printf("cannot resolve host %s : %s", err)
log.Printf("cannot resolve host %s(%s) : %s", host, network, err)
return
}

View File

@ -20,7 +20,7 @@ func (j JSON) String() string {
// Unmarshal your JSON variable into dest.
func (j JSON) Unmarshal(dest any) error {
iter := misc.JSONCodec.BorrowIterator(nil)
iter := misc.JSONCodec.BorrowIterator(j)
defer misc.JSONCodec.ReturnIterator(iter)
iter.ReadVal(dest)
return iter.Error

View File

@ -18,12 +18,12 @@ func TestJSONUnmarshal(t *testing.T) {
t.Parallel()
type JSONTest struct {
Name string
Age int
Name string `json:"name"`
Age int `json:"age"`
}
var jt JSONTest
j := JSON(`{"Name":"hi","Age":15}`)
j := JSON(`{"name":"hi","age":15}`)
err := j.Unmarshal(&jt)
if err != nil {
t.Error(err)
@ -41,8 +41,8 @@ func TestJSONMarshal(t *testing.T) {
t.Parallel()
type JSONTest struct {
Name string
Age int
Name string `json:"name"`
Age int `json:"age"`
}
jt := JSONTest{
Name: "hi",
@ -55,8 +55,8 @@ func TestJSONMarshal(t *testing.T) {
t.Error(err)
}
if j.String() != `{"Name":"hi","Age":15}` {
t.Errorf("expected %s, got %s", `{"Name":"hi","Age":15}`, j.String())
if j.String() != `{"name":"hi","age":15}` {
t.Errorf("expected %s, got %s", `{"name":"hi","age":15}`, j.String())
}
}
@ -92,7 +92,7 @@ func TestJSONMarshalJSON(t *testing.T) {
func TestJSONValue(t *testing.T) {
t.Parallel()
j := JSON(`{"Name":"hi","Age":15}`)
j := JSON(`{"name":"hi","age":15}`)
v, err := j.Value()
if err != nil {
t.Error(err)