diff options
Diffstat (limited to 'src/pkg/json/decode_test.go')
-rw-r--r-- | src/pkg/json/decode_test.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/pkg/json/decode_test.go b/src/pkg/json/decode_test.go index ad6026363..49135c4bf 100644 --- a/src/pkg/json/decode_test.go +++ b/src/pkg/json/decode_test.go @@ -21,7 +21,7 @@ type tx struct { x int } -var txType = reflect.Typeof((*tx)(nil)).(*reflect.PtrType).Elem().(*reflect.StructType) +var txType = reflect.Typeof((*tx)(nil)).Elem() // A type that can unmarshal itself. @@ -138,8 +138,8 @@ func TestUnmarshal(t *testing.T) { continue } // v = new(right-type) - v := reflect.NewValue(tt.ptr).(*reflect.PtrValue) - v.PointTo(reflect.MakeZero(v.Type().(*reflect.PtrType).Elem())) + v := reflect.NewValue(tt.ptr) + v.Set(reflect.Zero(v.Type().Elem()).Addr()) if err := Unmarshal([]byte(in), v.Interface()); !reflect.DeepEqual(err, tt.err) { t.Errorf("#%d: %v want %v", i, err, tt.err) continue @@ -157,6 +157,7 @@ func TestUnmarshal(t *testing.T) { } func TestUnmarshalMarshal(t *testing.T) { + initBig() var v interface{} if err := Unmarshal(jsonBig, &v); err != nil { t.Fatalf("Unmarshal: %v", err) |