casify reflect.

R=rsc
DELTA=513  (0 added, 2 deleted, 511 changed)
OCL=22954
CL=22956
This commit is contained in:
Rob Pike 2009-01-16 12:48:07 -08:00
parent aedfb397ae
commit ed2ac9b8b0
4 changed files with 354 additions and 356 deletions

View file

@ -87,8 +87,6 @@ func valuedump(s, t string) {
assert(reflect.ValueToString(v), t);
}
export type empty interface {}
export type T struct { a int; b float64; c string; d *int }
export func TestAll(tt *testing.T) { // TODO(r): wrap up better
@ -342,14 +340,14 @@ export func TestBigUnnamedStruct(t *testing.T) {
}
}
type Big struct {
type big struct {
a, b, c, d, e int64
}
export func TestBigStruct(t *testing.T) {
b := Big{1, 2, 3, 4, 5};
b := big{1, 2, 3, 4, 5};
v := NewValue(b);
b1 := v.Interface().(Big);
b1 := v.Interface().(big);
if b1.a != b.a || b1.b != b.b || b1.c != b.c || b1.d != b.d || b1.e != b.e {
t.Errorf("NewValue(%v).Interface().(Big) = %v", b, b1);
t.Errorf("NewValue(%v).Interface().(big) = %v", b, b1);
}
}