]> Cypherpunks repositories - gostls13.git/commitdiff
test: test slice beyond len
authorIan Lance Taylor <iant@golang.org>
Fri, 3 Feb 2012 14:29:30 +0000 (06:29 -0800)
committerIan Lance Taylor <iant@golang.org>
Fri, 3 Feb 2012 14:29:30 +0000 (06:29 -0800)
When slicing a slice, the bounds may be > len as long as they
are <= cap.  Interestingly, gccgo got that wrong and still
passed the testsuite and all the library tests.

R=golang-dev, rsc, iant
CC=golang-dev
https://golang.org/cl/5622053

test/ken/array.go

index 40209f5da377a5632a921832c9db64108293b46b..12694fec62bba531fa6f87a4113a35b8dd721c74 100644 (file)
@@ -68,6 +68,9 @@ func testpdpd() {
 
        a = a[5:25]
        res(sumpd(a), 5, 25)
+
+       a = a[30:95]
+       res(sumpd(a), 35, 100)
 }
 
 // call ptr fixed with ptr fixed