Browse Source

test unmarshalling as well in testJSONMarshal()

Will Norris 12 years ago
parent
commit
fb1d2d12e3
1 changed files with 10 additions and 0 deletions
  1. +10
    -0
      github/github_test.go

+ 10
- 0
github/github_test.go View File

@ -95,6 +95,16 @@ func testJSONMarshal(t *testing.T, v interface{}, want string) {
if w.String() != string(j) {
t.Errorf("json.Marshal(%q) returned %s, want %s", v, j, w)
}
// now go the other direction and make sure things unmarshal as expected
u := reflect.ValueOf(v).Interface()
if err := json.Unmarshal([]byte(want), u); err != nil {
t.Errorf("Unable to unmarshal JSON for %v", want)
}
if !reflect.DeepEqual(v, u) {
t.Errorf("json.Unmarshal(%q) returned %s, want %s", want, u, v)
}
}
func TestNewClient(t *testing.T) {


Loading…
Cancel
Save