]> Cypherpunks repositories - gostls13.git/commitdiff
tests: remove two misuses of nil pointers
authorRuss Cox <rsc@golang.org>
Thu, 15 Aug 2013 15:51:04 +0000 (11:51 -0400)
committerRuss Cox <rsc@golang.org>
Thu, 15 Aug 2013 15:51:04 +0000 (11:51 -0400)
R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/12858044

src/pkg/runtime/gc_test.go
test/recover3.go

index a3c731ccb0521b6d9c6297ebdeff8ced7bf89158..dbd68c1c75d6940be2ac7835153591eeeb1ce323 100644 (file)
@@ -136,7 +136,9 @@ func TestGcRescan(t *testing.T) {
        for i := 0; i < 10; i++ {
                p := &Y{}
                p.c = make(chan error)
-               p.nextx = &head.X
+               if head != nil {
+                       p.nextx = &head.X
+               }
                p.nexty = head
                p.p = new(int)
                *p.p = 42
index ebfa0a30757138fbf3e62e7a903b16aa7dc64392..e17bfb3f6aa53ab115bcefad02c8e61e06dead36 100644 (file)
@@ -64,7 +64,8 @@ func main() {
 
        i = 99999
        var sl []int
-       check("array-bounds", func() { println(p[i]) }, "index out of range")
+       p1 := new([10]int)
+       check("array-bounds", func() { println(p1[i]) }, "index out of range")
        check("slice-bounds", func() { println(sl[i]) }, "index out of range")
 
        var inter interface{}