mirror of
https://github.com/golang/go
synced 2024-11-23 16:40:03 -07:00
reflect: test to make sure big Zero()-obtained objects are really zero.
Update #6876. R=dave, bradfitz CC=golang-dev https://golang.org/cl/36370043
This commit is contained in:
parent
e7d899cba5
commit
742f755a29
@ -3640,3 +3640,14 @@ func TestReflectMethodTraceback(t *testing.T) {
|
||||
t.Errorf("Call returned %d; want 8", i)
|
||||
}
|
||||
}
|
||||
|
||||
func TestBigZero(t *testing.T) {
|
||||
const size = 1 << 10
|
||||
var v [size]byte
|
||||
z := Zero(ValueOf(v).Type()).Interface().([size]byte)
|
||||
for i := 0; i < size; i++ {
|
||||
if z[i] != 0 {
|
||||
t.Fatalf("Zero object not all zero, index %d", i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user