changes for more restricted reflect.SetValue

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/4423043
This commit is contained in:
Russ Cox 2011-04-18 14:36:22 -04:00
parent 40fccbce6b
commit cded21a337
14 changed files with 78 additions and 56 deletions

View file

@ -138,8 +138,7 @@ func TestUnmarshal(t *testing.T) {
continue
}
// v = new(right-type)
v := reflect.NewValue(tt.ptr)
v.Set(reflect.Zero(v.Type().Elem()).Addr())
v := reflect.New(reflect.Typeof(tt.ptr).Elem())
if err := Unmarshal([]byte(in), v.Interface()); !reflect.DeepEqual(err, tt.err) {
t.Errorf("#%d: %v want %v", i, err, tt.err)
continue