1
0
mirror of https://github.com/golang/go synced 2024-11-12 10:00:25 -07:00

reflect: remove unnecessary indirection in TestCopy.

R=r
CC=golang-dev
https://golang.org/cl/3642041
This commit is contained in:
Nigel Tao 2010-12-15 20:54:11 +11:00
parent 670e77b54d
commit d96685ed6a

View File

@ -549,15 +549,13 @@ func TestCopy(t *testing.T) {
a := []int{1, 2, 3, 4, 10, 9, 8, 7} a := []int{1, 2, 3, 4, 10, 9, 8, 7}
b := []int{11, 22, 33, 44, 1010, 99, 88, 77, 66, 55, 44} b := []int{11, 22, 33, 44, 1010, 99, 88, 77, 66, 55, 44}
c := []int{11, 22, 33, 44, 1010, 99, 88, 77, 66, 55, 44} c := []int{11, 22, 33, 44, 1010, 99, 88, 77, 66, 55, 44}
va := NewValue(&a)
vb := NewValue(&b)
for i := 0; i < len(b); i++ { for i := 0; i < len(b); i++ {
if b[i] != c[i] { if b[i] != c[i] {
t.Fatalf("b != c before test") t.Fatalf("b != c before test")
} }
} }
aa := va.(*PtrValue).Elem().(*SliceValue) aa := NewValue(a).(*SliceValue)
ab := vb.(*PtrValue).Elem().(*SliceValue) ab := NewValue(b).(*SliceValue)
for tocopy := 1; tocopy <= 7; tocopy++ { for tocopy := 1; tocopy <= 7; tocopy++ {
aa.SetLen(tocopy) aa.SetLen(tocopy)
Copy(ab, aa) Copy(ab, aa)