diff options
| author | Rob Pike <r@golang.org> | 2011-12-20 10:36:25 -0800 |
|---|---|---|
| committer | Rob Pike <r@golang.org> | 2011-12-20 10:36:25 -0800 |
| commit | 6b772462e420d15f5e1669a5f03e4f1cb7d8f2af (patch) | |
| tree | 6c54dc3455a36f21f5d12f9d3e8ea170cb7562db /src/pkg/bytes/bytes_test.go | |
| parent | b9697d4a58bfd6dd99e03123c3d53e4f1b035787 (diff) | |
| download | go-6b772462e420d15f5e1669a5f03e4f1cb7d8f2af.tar.xz | |
panics: use the new facilities of testing.B instead
Lots of panics go away.
Also fix a name error in html/template.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5498045
Diffstat (limited to 'src/pkg/bytes/bytes_test.go')
| -rw-r--r-- | src/pkg/bytes/bytes_test.go | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/src/pkg/bytes/bytes_test.go b/src/pkg/bytes/bytes_test.go index a2a08c20db..2a1d41b910 100644 --- a/src/pkg/bytes/bytes_test.go +++ b/src/pkg/bytes/bytes_test.go @@ -289,8 +289,7 @@ func bmIndexByte(b *testing.B, index func([]byte, byte) int, n int) { for i := 0; i < b.N; i++ { j := index(buf, 'x') if j != n-1 { - println("bad index", j) - panic("bad index") + b.Fatal("bad index", j) } } buf[n-1] = '\x00' @@ -317,7 +316,7 @@ func bmEqual(b *testing.B, equal func([]byte, []byte) bool, n int) { for i := 0; i < b.N; i++ { eq := equal(buf1, buf2) if !eq { - panic("bad equal") + b.Fatal("bad equal") } } buf1[n-1] = '\x00' @@ -339,8 +338,7 @@ func bmIndex(b *testing.B, index func([]byte, []byte) int, n int) { for i := 0; i < b.N; i++ { j := index(buf, buf[n-7:]) if j != n-7 { - println("bad index", j) - panic("bad index") + b.Fatal("bad index", j) } } buf[n-1] = '\x00' @@ -362,8 +360,7 @@ func bmIndexEasy(b *testing.B, index func([]byte, []byte) int, n int) { for i := 0; i < b.N; i++ { j := index(buf, buf[n-7:]) if j != n-7 { - println("bad index", j) - panic("bad index") + b.Fatal("bad index", j) } } buf[n-1] = '\x00' @@ -385,8 +382,7 @@ func bmCount(b *testing.B, count func([]byte, []byte) int, n int) { for i := 0; i < b.N; i++ { j := count(buf, buf[n-7:]) if j != 1 { - println("bad count", j) - panic("bad count") + b.Fatal("bad count", j) } } buf[n-1] = '\x00' @@ -408,8 +404,7 @@ func bmCountEasy(b *testing.B, count func([]byte, []byte) int, n int) { for i := 0; i < b.N; i++ { j := count(buf, buf[n-7:]) if j != 1 { - println("bad count", j) - panic("bad count") + b.Fatal("bad count", j) } } buf[n-1] = '\x00' |
