diff options
Diffstat (limited to 'libgo/go/fmt/scan_test.go')
-rw-r--r-- | libgo/go/fmt/scan_test.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/libgo/go/fmt/scan_test.go b/libgo/go/fmt/scan_test.go index 8eb3e5bfbb0..da13eb2d112 100644 --- a/libgo/go/fmt/scan_test.go +++ b/libgo/go/fmt/scan_test.go @@ -370,8 +370,8 @@ func testScan(name string, t *testing.T, scan func(r io.Reader, a ...interface{} continue } // The incoming value may be a pointer - v := reflect.NewValue(test.in) - if p, ok := v.(*reflect.PtrValue); ok { + v := reflect.ValueOf(test.in) + if p := v; p.Kind() == reflect.Ptr { v = p.Elem() } val := v.Interface() @@ -409,8 +409,8 @@ func TestScanf(t *testing.T) { continue } // The incoming value may be a pointer - v := reflect.NewValue(test.in) - if p, ok := v.(*reflect.PtrValue); ok { + v := reflect.ValueOf(test.in) + if p := v; p.Kind() == reflect.Ptr { v = p.Elem() } val := v.Interface() @@ -486,7 +486,7 @@ func TestInf(t *testing.T) { } func testScanfMulti(name string, t *testing.T) { - sliceType := reflect.Typeof(make([]interface{}, 1)).(*reflect.SliceType) + sliceType := reflect.TypeOf(make([]interface{}, 1)) for _, test := range multiTests { var r io.Reader if name == "StringReader" { @@ -513,8 +513,8 @@ func testScanfMulti(name string, t *testing.T) { // Convert the slice of pointers into a slice of values resultVal := reflect.MakeSlice(sliceType, n, n) for i := 0; i < n; i++ { - v := reflect.NewValue(test.in[i]).(*reflect.PtrValue).Elem() - resultVal.Elem(i).(*reflect.InterfaceValue).Set(v) + v := reflect.ValueOf(test.in[i]).Elem() + resultVal.Index(i).Set(v) } result := resultVal.Interface() if !reflect.DeepEqual(result, test.out) { |