Skip to content

Commit

Permalink
setters tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GRbit committed Mar 9, 2023
1 parent c9ebcc9 commit 5b6825f
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,39 @@ func TestClientNewRequest(t *testing.T) {
assertNotNil(t, request)
}


func TestClientSetJSONMarshaler(t *testing.T) {
m := func (v interface{}) ([]byte, error) { return nil,nil }
c := New().SetJSONMarshaler(m)
p1 := fmt.Sprintf("%p", c.JSONMarshal)
p2 := fmt.Sprintf("%p", m)
assertEqual(t, p1, p2) // functions can not be compared, we only can compare pointers
}

func TestClientSetJSONUnmarshaler(t *testing.T) {
m := func ([]byte, interface{}) error { return nil }
c := New().SetJSONUnmarshaler(m)
p1 := fmt.Sprintf("%p", c.JSONUnmarshal)
p2 := fmt.Sprintf("%p", m)
assertEqual(t, p1, p2) // functions can not be compared, we only can compare pointers
}

func TestClientSetXMLMarshaler(t *testing.T) {
m := func (v interface{}) ([]byte, error) { return nil,nil }
c := New().SetXMLMarshaler(m)
p1 := fmt.Sprintf("%p", c.XMLMarshal)
p2 := fmt.Sprintf("%p", m)
assertEqual(t, p1, p2) // functions can not be compared, we only can compare pointers
}

func TestClientSetXMLUnmarshaler(t *testing.T) {
m := func ([]byte, interface{}) error { return nil }
c := New().SetXMLUnmarshaler(m)
p1 := fmt.Sprintf("%p", c.XMLUnmarshal)
p2 := fmt.Sprintf("%p", m)
assertEqual(t, p1, p2) // functions can not be compared, we only can compare pointers
}

func TestDebugBodySizeLimit(t *testing.T) {
ts := createGetServer(t)
defer ts.Close()
Expand Down

0 comments on commit 5b6825f

Please sign in to comment.