mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
update sys.reflect and sys.unreflect to accomodate
the possibility of large objects in interface values. R=r DELTA=171 (97 added, 22 deleted, 52 changed) OCL=22382 CL=22382
This commit is contained in:
parent
51c3ac7e3f
commit
484ba939d2
7 changed files with 138 additions and 63 deletions
|
|
@ -332,3 +332,24 @@ export func TestCopyArray(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
export func TestBigUnnamedStruct(t *testing.T) {
|
||||
b := struct{a,b,c,d int64}{1, 2, 3, 4};
|
||||
v := NewValue(b);
|
||||
b1 := v.Interface().(struct{a,b,c,d int64});
|
||||
if b1.a != b.a || b1.b != b.b || b1.c != b.c || b1.d != b.d {
|
||||
t.Errorf("NewValue(%v).Interface().(Big) = %v", b, b1);
|
||||
}
|
||||
}
|
||||
|
||||
type Big struct {
|
||||
a, b, c, d, e int64
|
||||
}
|
||||
export func TestBigStruct(t *testing.T) {
|
||||
b := Big{1, 2, 3, 4, 5};
|
||||
v := NewValue(b);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue