aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2010-12-07 16:42:54 -0500
committerRob Pike <r@golang.org>2010-12-07 16:42:54 -0500
commit1ce6245d6cc313daba1a4d7b5b349328e18bba6b (patch)
tree267b7a6a454a3702e85696b570823bf3576bec9a
parentab7884da7eaea4ced7414c710aa0a5622e8eabd6 (diff)
downloadgo-1ce6245d6cc313daba1a4d7b5b349328e18bba6b.tar.gz
go-1ce6245d6cc313daba1a4d7b5b349328e18bba6b.zip
throughout: fix broken calls to Printf etc.
I have written a tool to verify Printf calls, and although it's not ready to be reviewed yet it's already uncovered a spate of problems in the repository. I'm sending this CL to break the changes into pieces; as the tool improves it will find more, I'm sure. R=rsc CC=golang-dev https://golang.org/cl/3427043
-rw-r--r--src/pkg/archive/zip/reader_test.go4
-rwxr-xr-xsrc/pkg/big/int_test.go2
-rw-r--r--src/pkg/bufio/bufio_test.go6
-rw-r--r--src/pkg/bytes/buffer_test.go2
-rw-r--r--src/pkg/container/vector/intvector_test.go48
-rw-r--r--src/pkg/container/vector/stringvector_test.go48
-rw-r--r--src/pkg/container/vector/vector_test.go48
-rw-r--r--src/pkg/crypto/elliptic/elliptic_test.go2
-rw-r--r--src/pkg/fmt/scan_test.go6
-rw-r--r--src/pkg/gob/codec_test.go4
-rw-r--r--src/pkg/json/scanner_test.go4
-rw-r--r--src/pkg/json/stream_test.go4
-rw-r--r--src/pkg/netchan/netchan_test.go2
-rw-r--r--src/pkg/os/os_test.go6
-rw-r--r--src/pkg/os/path_test.go6
-rw-r--r--src/pkg/path/path_test.go2
-rw-r--r--src/pkg/reflect/all_test.go2
-rw-r--r--src/pkg/strconv/atob_test.go2
-rw-r--r--src/pkg/syslog/syslog_test.go2
-rw-r--r--src/pkg/time/tick_test.go2
-rw-r--r--src/pkg/unicode/maketables.go12
-rw-r--r--src/pkg/utf8/string_test.go8
-rw-r--r--src/pkg/utf8/utf8_test.go2
-rw-r--r--src/pkg/websocket/websocket_test.go2
-rw-r--r--src/pkg/xml/xml_test.go2
25 files changed, 114 insertions, 114 deletions
diff --git a/src/pkg/archive/zip/reader_test.go b/src/pkg/archive/zip/reader_test.go
index 8e1fbbfa51..3c24f1467c 100644
--- a/src/pkg/archive/zip/reader_test.go
+++ b/src/pkg/archive/zip/reader_test.go
@@ -111,7 +111,7 @@ func readTestZip(t *testing.T, zt ZipTest) {
var b bytes.Buffer
_, err = io.Copy(&b, r)
if err != ChecksumError {
- t.Errorf("%s: copy error=%v, want %v", err, ChecksumError)
+ t.Errorf("%s: copy error=%v, want %v", z.File[0].Name, err, ChecksumError)
}
}
@@ -144,7 +144,7 @@ func readTestFile(t *testing.T, ft ZipTestFile, f *File) {
}
for i, b := range b.Bytes() {
if b != c[i] {
- t.Errorf("%s: content[%d]=%q want %q", i, b, c[i])
+ t.Errorf("%s: content[%d]=%q want %q", f.Name, i, b, c[i])
return
}
}
diff --git a/src/pkg/big/int_test.go b/src/pkg/big/int_test.go
index 818d0c6dbc..fc981e1da4 100755
--- a/src/pkg/big/int_test.go
+++ b/src/pkg/big/int_test.go
@@ -94,7 +94,7 @@ func testFunZZ(t *testing.T, msg string, f funZZ, a argZZ) {
var z Int
f(&z, a.x, a.y)
if !isNormalized(&z) {
- t.Errorf("msg: %v is not normalized", z, msg)
+ t.Errorf("%s%v is not normalized", z, msg)
}
if (&z).Cmp(a.z) != 0 {
t.Errorf("%s%+v\n\tgot z = %v; want %v", msg, a, &z, a.z)
diff --git a/src/pkg/bufio/bufio_test.go b/src/pkg/bufio/bufio_test.go
index d84d18768e..059ca6dd22 100644
--- a/src/pkg/bufio/bufio_test.go
+++ b/src/pkg/bufio/bufio_test.go
@@ -397,9 +397,9 @@ func TestWriter(t *testing.T) {
}
for l := 0; l < len(written); l++ {
if written[i] != data[i] {
- t.Errorf("%s: wrong bytes written")
- t.Errorf("want=%s", data[0:len(written)])
- t.Errorf("have=%s", written)
+ t.Errorf("wrong bytes written")
+ t.Errorf("want=%q", data[0:len(written)])
+ t.Errorf("have=%q", written)
}
}
}
diff --git a/src/pkg/bytes/buffer_test.go b/src/pkg/bytes/buffer_test.go
index ef42d430cb..509793d24a 100644
--- a/src/pkg/bytes/buffer_test.go
+++ b/src/pkg/bytes/buffer_test.go
@@ -165,7 +165,7 @@ func TestBasicOperations(t *testing.T) {
t.Error("ReadByte unexpected eof")
}
if c != data[1] {
- t.Error("ReadByte wrong value c=%v", c)
+ t.Errorf("ReadByte wrong value c=%v", c)
}
c, err = buf.ReadByte()
if err == nil {
diff --git a/src/pkg/container/vector/intvector_test.go b/src/pkg/container/vector/intvector_test.go
index fcc7403b36..1e38a1982f 100644
--- a/src/pkg/container/vector/intvector_test.go
+++ b/src/pkg/container/vector/intvector_test.go
@@ -127,59 +127,59 @@ func TestIntInsertDeleteClear(t *testing.T) {
for i := 0; i < n; i++ {
if a.Len() != i {
- t.Errorf("T%: A) wrong Len() %d (expected %d)", a, a.Len(), i)
+ t.Errorf("%T: A) wrong Len() %d (expected %d)", a, a.Len(), i)
}
if len(a) != i {
- t.Errorf("T%: A) wrong len() %d (expected %d)", a, len(a), i)
+ t.Errorf("%T: A) wrong len() %d (expected %d)", a, len(a), i)
}
a.Insert(0, int2IntValue(val(i)))
if elem2IntValue(a.Last()) != int2IntValue(val(0)) {
- t.Error("T%: B", a)
+ t.Errorf("%T: B", a)
}
}
for i := n - 1; i >= 0; i-- {
if elem2IntValue(a.Last()) != int2IntValue(val(0)) {
- t.Error("T%: C", a)
+ t.Errorf("%T: C", a)
}
if elem2IntValue(a.At(0)) != int2IntValue(val(i)) {
- t.Error("T%: D", a)
+ t.Errorf("%T: D", a)
}
if elem2IntValue(a[0]) != int2IntValue(val(i)) {
- t.Error("T%: D2", a)
+ t.Errorf("%T: D2", a)
}
a.Delete(0)
if a.Len() != i {
- t.Errorf("T%: E) wrong Len() %d (expected %d)", a, a.Len(), i)
+ t.Errorf("%T: E) wrong Len() %d (expected %d)", a, a.Len(), i)
}
if len(a) != i {
- t.Errorf("T%: E) wrong len() %d (expected %d)", a, len(a), i)
+ t.Errorf("%T: E) wrong len() %d (expected %d)", a, len(a), i)
}
}
if a.Len() != 0 {
- t.Errorf("T%: F) wrong Len() %d (expected 0)", a, a.Len())
+ t.Errorf("%T: F) wrong Len() %d (expected 0)", a, a.Len())
}
if len(a) != 0 {
- t.Errorf("T%: F) wrong len() %d (expected 0)", a, len(a))
+ t.Errorf("%T: F) wrong len() %d (expected 0)", a, len(a))
}
for i := 0; i < n; i++ {
a.Push(int2IntValue(val(i)))
if a.Len() != i+1 {
- t.Errorf("T%: G) wrong Len() %d (expected %d)", a, a.Len(), i+1)
+ t.Errorf("%T: G) wrong Len() %d (expected %d)", a, a.Len(), i+1)
}
if len(a) != i+1 {
- t.Errorf("T%: G) wrong len() %d (expected %d)", a, len(a), i+1)
+ t.Errorf("%T: G) wrong len() %d (expected %d)", a, len(a), i+1)
}
if elem2IntValue(a.Last()) != int2IntValue(val(i)) {
- t.Error("T%: H", a)
+ t.Errorf("%T: H", a)
}
}
a.Resize(0, 0)
if a.Len() != 0 {
- t.Errorf("T%: I wrong Len() %d (expected 0)", a, a.Len())
+ t.Errorf("%T: I wrong Len() %d (expected 0)", a, a.Len())
}
if len(a) != 0 {
- t.Errorf("T%: I wrong len() %d (expected 0)", a, len(a))
+ t.Errorf("%T: I wrong len() %d (expected 0)", a, len(a))
}
const m = 5
@@ -189,21 +189,21 @@ func TestIntInsertDeleteClear(t *testing.T) {
x := val(i)
a.Push(int2IntValue(x))
if elem2IntValue(a.Pop()) != int2IntValue(x) {
- t.Error("T%: J", a)
+ t.Errorf("%T: J", a)
}
if a.Len() != j+1 {
- t.Errorf("T%: K) wrong Len() %d (expected %d)", a, a.Len(), j+1)
+ t.Errorf("%T: K) wrong Len() %d (expected %d)", a, a.Len(), j+1)
}
if len(a) != j+1 {
- t.Errorf("T%: K) wrong len() %d (expected %d)", a, len(a), j+1)
+ t.Errorf("%T: K) wrong len() %d (expected %d)", a, len(a), j+1)
}
}
}
if a.Len() != m {
- t.Errorf("T%: L) wrong Len() %d (expected %d)", a, a.Len(), m)
+ t.Errorf("%T: L) wrong Len() %d (expected %d)", a, a.Len(), m)
}
if len(a) != m {
- t.Errorf("T%: L) wrong len() %d (expected %d)", a, len(a), m)
+ t.Errorf("%T: L) wrong len() %d (expected %d)", a, len(a), m)
}
}
@@ -211,14 +211,14 @@ func TestIntInsertDeleteClear(t *testing.T) {
func verify_sliceInt(t *testing.T, x *IntVector, elt, i, j int) {
for k := i; k < j; k++ {
if elem2IntValue(x.At(k)) != int2IntValue(elt) {
- t.Errorf("T%: M) wrong [%d] element %v (expected %v)", x, k, elem2IntValue(x.At(k)), int2IntValue(elt))
+ t.Errorf("%T: M) wrong [%d] element %v (expected %v)", x, k, elem2IntValue(x.At(k)), int2IntValue(elt))
}
}
s := x.Slice(i, j)
for k, n := 0, j-i; k < n; k++ {
if elem2IntValue(s.At(k)) != int2IntValue(elt) {
- t.Errorf("T%: N) wrong [%d] element %v (expected %v)", x, k, elem2IntValue(x.At(k)), int2IntValue(elt))
+ t.Errorf("%T: N) wrong [%d] element %v (expected %v)", x, k, elem2IntValue(x.At(k)), int2IntValue(elt))
}
}
}
@@ -227,10 +227,10 @@ func verify_sliceInt(t *testing.T, x *IntVector, elt, i, j int) {
func verify_patternInt(t *testing.T, x *IntVector, a, b, c int) {
n := a + b + c
if x.Len() != n {
- t.Errorf("T%: O) wrong Len() %d (expected %d)", x, x.Len(), n)
+ t.Errorf("%T: O) wrong Len() %d (expected %d)", x, x.Len(), n)
}
if len(*x) != n {
- t.Errorf("T%: O) wrong len() %d (expected %d)", x, len(*x), n)
+ t.Errorf("%T: O) wrong len() %d (expected %d)", x, len(*x), n)
}
verify_sliceInt(t, x, 0, 0, a)
verify_sliceInt(t, x, 1, a, a+b)
diff --git a/src/pkg/container/vector/stringvector_test.go b/src/pkg/container/vector/stringvector_test.go
index 2f3f082bdc..776ae26dea 100644
--- a/src/pkg/container/vector/stringvector_test.go
+++ b/src/pkg/container/vector/stringvector_test.go
@@ -127,59 +127,59 @@ func TestStrInsertDeleteClear(t *testing.T) {
for i := 0; i < n; i++ {
if a.Len() != i {
- t.Errorf("T%: A) wrong Len() %d (expected %d)", a, a.Len(), i)
+ t.Errorf("%T: A) wrong Len() %d (expected %d)", a, a.Len(), i)
}
if len(a) != i {
- t.Errorf("T%: A) wrong len() %d (expected %d)", a, len(a), i)
+ t.Errorf("%T: A) wrong len() %d (expected %d)", a, len(a), i)
}
a.Insert(0, int2StrValue(val(i)))
if elem2StrValue(a.Last()) != int2StrValue(val(0)) {
- t.Error("T%: B", a)
+ t.Errorf("%T: B", a)
}
}
for i := n - 1; i >= 0; i-- {
if elem2StrValue(a.Last()) != int2StrValue(val(0)) {
- t.Error("T%: C", a)
+ t.Errorf("%T: C", a)
}
if elem2StrValue(a.At(0)) != int2StrValue(val(i)) {
- t.Error("T%: D", a)
+ t.Errorf("%T: D", a)
}
if elem2StrValue(a[0]) != int2StrValue(val(i)) {
- t.Error("T%: D2", a)
+ t.Errorf("%T: D2", a)
}
a.Delete(0)
if a.Len() != i {
- t.Errorf("T%: E) wrong Len() %d (expected %d)", a, a.Len(), i)
+ t.Errorf("%T: E) wrong Len() %d (expected %d)", a, a.Len(), i)
}
if len(a) != i {
- t.Errorf("T%: E) wrong len() %d (expected %d)", a, len(a), i)
+ t.Errorf("%T: E) wrong len() %d (expected %d)", a, len(a), i)
}
}
if a.Len() != 0 {
- t.Errorf("T%: F) wrong Len() %d (expected 0)", a, a.Len())
+ t.Errorf("%T: F) wrong Len() %d (expected 0)", a, a.Len())
}
if len(a) != 0 {
- t.Errorf("T%: F) wrong len() %d (expected 0)", a, len(a))
+ t.Errorf("%T: F) wrong len() %d (expected 0)", a, len(a))
}
for i := 0; i < n; i++ {
a.Push(int2StrValue(val(i)))
if a.Len() != i+1 {
- t.Errorf("T%: G) wrong Len() %d (expected %d)", a, a.Len(), i+1)
+ t.Errorf("%T: G) wrong Len() %d (expected %d)", a, a.Len(), i+1)
}
if len(a) != i+1 {
- t.Errorf("T%: G) wrong len() %d (expected %d)", a, len(a), i+1)
+ t.Errorf("%T: G) wrong len() %d (expected %d)", a, len(a), i+1)
}
if elem2StrValue(a.Last()) != int2StrValue(val(i)) {
- t.Error("T%: H", a)
+ t.Errorf("%T: H", a)
}
}
a.Resize(0, 0)
if a.Len() != 0 {
- t.Errorf("T%: I wrong Len() %d (expected 0)", a, a.Len())
+ t.Errorf("%T: I wrong Len() %d (expected 0)", a, a.Len())
}
if len(a) != 0 {
- t.Errorf("T%: I wrong len() %d (expected 0)", a, len(a))
+ t.Errorf("%T: I wrong len() %d (expected 0)", a, len(a))
}
const m = 5
@@ -189,21 +189,21 @@ func TestStrInsertDeleteClear(t *testing.T) {
x := val(i)
a.Push(int2StrValue(x))
if elem2StrValue(a.Pop()) != int2StrValue(x) {
- t.Error("T%: J", a)
+ t.Errorf("%T: J", a)
}
if a.Len() != j+1 {
- t.Errorf("T%: K) wrong Len() %d (expected %d)", a, a.Len(), j+1)
+ t.Errorf("%T: K) wrong Len() %d (expected %d)", a, a.Len(), j+1)
}
if len(a) != j+1 {
- t.Errorf("T%: K) wrong len() %d (expected %d)", a, len(a), j+1)
+ t.Errorf("%T: K) wrong len() %d (expected %d)", a, len(a), j+1)
}
}
}
if a.Len() != m {
- t.Errorf("T%: L) wrong Len() %d (expected %d)", a, a.Len(), m)
+ t.Errorf("%T: L) wrong Len() %d (expected %d)", a, a.Len(), m)
}
if len(a) != m {
- t.Errorf("T%: L) wrong len() %d (expected %d)", a, len(a), m)
+ t.Errorf("%T: L) wrong len() %d (expected %d)", a, len(a), m)
}
}
@@ -211,14 +211,14 @@ func TestStrInsertDeleteClear(t *testing.T) {
func verify_sliceStr(t *testing.T, x *StringVector, elt, i, j int) {
for k := i; k < j; k++ {
if elem2StrValue(x.At(k)) != int2StrValue(elt) {
- t.Errorf("T%: M) wrong [%d] element %v (expected %v)", x, k, elem2StrValue(x.At(k)), int2StrValue(elt))
+ t.Errorf("%T: M) wrong [%d] element %v (expected %v)", x, k, elem2StrValue(x.At(k)), int2StrValue(elt))
}
}
s := x.Slice(i, j)
for k, n := 0, j-i; k < n; k++ {
if elem2StrValue(s.At(k)) != int2StrValue(elt) {
- t.Errorf("T%: N) wrong [%d] element %v (expected %v)", x, k, elem2StrValue(x.At(k)), int2StrValue(elt))
+ t.Errorf("%T: N) wrong [%d] element %v (expected %v)", x, k, elem2StrValue(x.At(k)), int2StrValue(elt))
}
}
}
@@ -227,10 +227,10 @@ func verify_sliceStr(t *testing.T, x *StringVector, elt, i, j int) {
func verify_patternStr(t *testing.T, x *StringVector, a, b, c int) {
n := a + b + c
if x.Len() != n {
- t.Errorf("T%: O) wrong Len() %d (expected %d)", x, x.Len(), n)
+ t.Errorf("%T: O) wrong Len() %d (expected %d)", x, x.Len(), n)
}
if len(*x) != n {
- t.Errorf("T%: O) wrong len() %d (expected %d)", x, len(*x), n)
+ t.Errorf("%T: O) wrong len() %d (expected %d)", x, len(*x), n)
}
verify_sliceStr(t, x, 0, 0, a)
verify_sliceStr(t, x, 1, a, a+b)
diff --git a/src/pkg/container/vector/vector_test.go b/src/pkg/container/vector/vector_test.go
index 986dff2da7..a9c4ceb55a 100644
--- a/src/pkg/container/vector/vector_test.go
+++ b/src/pkg/container/vector/vector_test.go
@@ -127,59 +127,59 @@ func TestInsertDeleteClear(t *testing.T) {
for i := 0; i < n; i++ {
if a.Len() != i {
- t.Errorf("T%: A) wrong Len() %d (expected %d)", a, a.Len(), i)
+ t.Errorf("%T: A) wrong Len() %d (expected %d)", a, a.Len(), i)
}
if len(a) != i {
- t.Errorf("T%: A) wrong len() %d (expected %d)", a, len(a), i)
+ t.Errorf("%T: A) wrong len() %d (expected %d)", a, len(a), i)
}
a.Insert(0, int2Value(val(i)))
if elem2Value(a.Last()) != int2Value(val(0)) {
- t.Error("T%: B", a)
+ t.Errorf("%T: B", a)
}
}
for i := n - 1; i >= 0; i-- {
if elem2Value(a.Last()) != int2Value(val(0)) {
- t.Error("T%: C", a)
+ t.Errorf("%T: C", a)
}
if elem2Value(a.At(0)) != int2Value(val(i)) {
- t.Error("T%: D", a)
+ t.Errorf("%T: D", a)
}
if elem2Value(a[0]) != int2Value(val(i)) {
- t.Error("T%: D2", a)
+ t.Errorf("%T: D2", a)
}
a.Delete(0)
if a.Len() != i {
- t.Errorf("T%: E) wrong Len() %d (expected %d)", a, a.Len(), i)
+ t.Errorf("%T: E) wrong Len() %d (expected %d)", a, a.Len(), i)
}
if len(a) != i {
- t.Errorf("T%: E) wrong len() %d (expected %d)", a, len(a), i)
+ t.Errorf("%T: E) wrong len() %d (expected %d)", a, len(a), i)
}
}
if a.Len() != 0 {
- t.Errorf("T%: F) wrong Len() %d (expected 0)", a, a.Len())
+ t.Errorf("%T: F) wrong Len() %d (expected 0)", a, a.Len())
}
if len(a) != 0 {
- t.Errorf("T%: F) wrong len() %d (expected 0)", a, len(a))
+ t.Errorf("%T: F) wrong len() %d (expected 0)", a, len(a))
}
for i := 0; i < n; i++ {
a.Push(int2Value(val(i)))
if a.Len() != i+1 {
- t.Errorf("T%: G) wrong Len() %d (expected %d)", a, a.Len(), i+1)
+ t.Errorf("%T: G) wrong Len() %d (expected %d)", a, a.Len(), i+1)
}
if len(a) != i+1 {
- t.Errorf("T%: G) wrong len() %d (expected %d)", a, len(a), i+1)
+ t.Errorf("%T: G) wrong len() %d (expected %d)", a, len(a), i+1)
}
if elem2Value(a.Last()) != int2Value(val(i)) {
- t.Error("T%: H", a)
+ t.Errorf("%T: H", a)
}
}
a.Resize(0, 0)
if a.Len() != 0 {
- t.Errorf("T%: I wrong Len() %d (expected 0)", a, a.Len())
+ t.Errorf("%T: I wrong Len() %d (expected 0)", a, a.Len())
}
if len(a) != 0 {
- t.Errorf("T%: I wrong len() %d (expected 0)", a, len(a))
+ t.Errorf("%T: I wrong len() %d (expected 0)", a, len(a))
}
const m = 5
@@ -189,21 +189,21 @@ func TestInsertDeleteClear(t *testing.T) {
x := val(i)
a.Push(int2Value(x))
if elem2Value(a.Pop()) != int2Value(x) {
- t.Error("T%: J", a)
+ t.Errorf("%T: J", a)
}
if a.Len() != j+1 {
- t.Errorf("T%: K) wrong Len() %d (expected %d)", a, a.Len(), j+1)
+ t.Errorf("%T: K) wrong Len() %d (expected %d)", a, a.Len(), j+1)
}
if len(a) != j+1 {
- t.Errorf("T%: K) wrong len() %d (expected %d)", a, len(a), j+1)
+ t.Errorf("%T: K) wrong len() %d (expected %d)", a, len(a), j+1)
}
}
}
if a.Len() != m {
- t.Errorf("T%: L) wrong Len() %d (expected %d)", a, a.Len(), m)
+ t.Errorf("%T: L) wrong Len() %d (expected %d)", a, a.Len(), m)
}
if len(a) != m {
- t.Errorf("T%: L) wrong len() %d (expected %d)", a, len(a), m)
+ t.Errorf("%T: L) wrong len() %d (expected %d)", a, len(a), m)
}
}
@@ -211,14 +211,14 @@ func TestInsertDeleteClear(t *testing.T) {
func verify_slice(t *testing.T, x *Vector, elt, i, j int) {
for k := i; k < j; k++ {
if elem2Value(x.At(k)) != int2Value(elt) {
- t.Errorf("T%: M) wrong [%d] element %v (expected %v)", x, k, elem2Value(x.At(k)), int2Value(elt))
+ t.Errorf("%T: M) wrong [%d] element %v (expected %v)", x, k, elem2Value(x.At(k)), int2Value(elt))
}
}
s := x.Slice(i, j)
for k, n := 0, j-i; k < n; k++ {
if elem2Value(s.At(k)) != int2Value(elt) {
- t.Errorf("T%: N) wrong [%d] element %v (expected %v)", x, k, elem2Value(x.At(k)), int2Value(elt))
+ t.Errorf("%T: N) wrong [%d] element %v (expected %v)", x, k, elem2Value(x.At(k)), int2Value(elt))
}
}
}
@@ -227,10 +227,10 @@ func verify_slice(t *testing.T, x *Vector, elt, i, j int) {
func verify_pattern(t *testing.T, x *Vector, a, b, c int) {
n := a + b + c
if x.Len() != n {
- t.Errorf("T%: O) wrong Len() %d (expected %d)", x, x.Len(), n)
+ t.Errorf("%T: O) wrong Len() %d (expected %d)", x, x.Len(), n)
}
if len(*x) != n {
- t.Errorf("T%: O) wrong len() %d (expected %d)", x, len(*x), n)
+ t.Errorf("%T: O) wrong len() %d (expected %d)", x, len(*x), n)
}
verify_slice(t, x, 0, 0, a)
verify_slice(t, x, 1, a, a+b)
diff --git a/src/pkg/crypto/elliptic/elliptic_test.go b/src/pkg/crypto/elliptic/elliptic_test.go
index a04b1fa106..25c2071ca3 100644
--- a/src/pkg/crypto/elliptic/elliptic_test.go
+++ b/src/pkg/crypto/elliptic/elliptic_test.go
@@ -290,7 +290,7 @@ func TestBaseMult(t *testing.T) {
for i, e := range p224BaseMultTests {
k, ok := new(big.Int).SetString(e.k, 10)
if !ok {
- t.Errorf("%d: bad value for k: %s", e.k)
+ t.Errorf("%d: bad value for k: %s", i, e.k)
}
x, y := p224.ScalarBaseMult(k.Bytes())
if fmt.Sprintf("%x", x) != e.x || fmt.Sprintf("%x", y) != e.y {
diff --git a/src/pkg/fmt/scan_test.go b/src/pkg/fmt/scan_test.go
index 7a0baae245..fe5ee1d617 100644
--- a/src/pkg/fmt/scan_test.go
+++ b/src/pkg/fmt/scan_test.go
@@ -532,7 +532,7 @@ func TestScanMultiple(t *testing.T) {
t.Errorf("Sscan count error: expected 1: got %d", n)
}
if err == nil {
- t.Errorf("Sscan expected error; got none", err)
+ t.Errorf("Sscan expected error; got none: %s", err)
}
if s != "asdf" {
t.Errorf("Sscan wrong values: got %q expected \"asdf\"", s)
@@ -547,7 +547,7 @@ func TestScanEmpty(t *testing.T) {
t.Errorf("Sscan count error: expected 1: got %d", n)
}
if err == nil {
- t.Errorf("Sscan <one item> expected error; got none")
+ t.Error("Sscan <one item> expected error; got none")
}
if s1 != "abc" {
t.Errorf("Sscan wrong values: got %q expected \"abc\"", s1)
@@ -557,7 +557,7 @@ func TestScanEmpty(t *testing.T) {
t.Errorf("Sscan count error: expected 0: got %d", n)
}
if err == nil {
- t.Errorf("Sscan <empty> expected error; got none")
+ t.Error("Sscan <empty> expected error; got none")
}
// Quoted empty string is OK.
n, err = Sscanf(`""`, "%q", &s1)
diff --git a/src/pkg/gob/codec_test.go b/src/pkg/gob/codec_test.go
index a95cfa9929..3fe5fe2b00 100644
--- a/src/pkg/gob/codec_test.go
+++ b/src/pkg/gob/codec_test.go
@@ -829,7 +829,7 @@ func TestNesting(t *testing.T) {
dec := NewDecoder(b)
err := dec.Decode(&drt)
if err != nil {
- t.Errorf("decoder error:", err)
+ t.Error("decoder error:", err)
}
if drt.a != rt.a {
t.Errorf("nesting: encode expected %v got %v", *rt, drt)
@@ -1196,7 +1196,7 @@ func TestInterface(t *testing.T) {
}
continue
if v1.Square() != v2.Square() {
- t.Errorf("item %d inconsistent values: %v %v", v1, v2)
+ t.Errorf("item %d inconsistent values: %v %v", i, v1, v2)
}
}
}
diff --git a/src/pkg/json/scanner_test.go b/src/pkg/json/scanner_test.go
index b90f5811b7..2dc8ff87fb 100644
--- a/src/pkg/json/scanner_test.go
+++ b/src/pkg/json/scanner_test.go
@@ -138,7 +138,7 @@ func TestNextValueBig(t *testing.T) {
var scan scanner
item, rest, err := nextValue(jsonBig, &scan)
if err != nil {
- t.Fatalf("nextValue: ", err)
+ t.Fatalf("nextValue: %s", err)
}
if len(item) != len(jsonBig) || &item[0] != &jsonBig[0] {
t.Errorf("invalid item: %d %d", len(item), len(jsonBig))
@@ -149,7 +149,7 @@ func TestNextValueBig(t *testing.T) {
item, rest, err = nextValue(append(jsonBig, []byte("HELLO WORLD")...), &scan)
if err != nil {
- t.Fatalf("nextValue extra: ", err)
+ t.Fatalf("nextValue extra: %s", err)
}
if len(item) != len(jsonBig) {
t.Errorf("invalid item: %d %d", len(item), len(jsonBig))
diff --git a/src/pkg/json/stream_test.go b/src/pkg/json/stream_test.go
index ab90b754e1..c83cfe3a93 100644
--- a/src/pkg/json/stream_test.go
+++ b/src/pkg/json/stream_test.go
@@ -71,10 +71,10 @@ func TestDecoder(t *testing.T) {
}
}
if !reflect.DeepEqual(out, streamTest[0:i]) {
- t.Errorf("decoding %d items: mismatch")
+ t.Errorf("decoding %d items: mismatch", i)
for j := range out {
if !reflect.DeepEqual(out[j], streamTest[j]) {
- t.Errorf("#%d: have %v want %v", out[j], streamTest[j])
+ t.Errorf("#%d: have %v want %v", j, out[j], streamTest[j])
}
}
break
diff --git a/src/pkg/netchan/netchan_test.go b/src/pkg/netchan/netchan_test.go
index 707111a094..766c4c4740 100644
--- a/src/pkg/netchan/netchan_test.go
+++ b/src/pkg/netchan/netchan_test.go
@@ -79,7 +79,7 @@ func importReceive(imp *Importer, t *testing.T, done chan bool) {
break
}
if v != 23+i {
- t.Errorf("importReceive: bad value: expected %%d+%d=%d; got %+d", base, i, base+i, v)
+ t.Errorf("importReceive: bad value: expected %d+%d=%d; got %+d", base, i, base+i, v)
}
}
if done != nil {
diff --git a/src/pkg/os/os_test.go b/src/pkg/os/os_test.go
index 0bbb686e18..d60a52f850 100644
--- a/src/pkg/os/os_test.go
+++ b/src/pkg/os/os_test.go
@@ -165,7 +165,7 @@ func testReaddirnames(dir string, contents []string, t *testing.T) {
}
s, err2 := file.Readdirnames(-1)
if err2 != nil {
- t.Fatalf("readdirnames %q failed: %v", err2)
+ t.Fatalf("readdirnames %q failed: %v", dir, err2)
}
for _, m := range contents {
found := false
@@ -264,7 +264,7 @@ func TestReaddirnamesOneAtATime(t *testing.T) {
small := smallReaddirnames(file1, len(all)+100, t) // +100 in case we screw up
for i, n := range all {
if small[i] != n {
- t.Errorf("small read %q %q mismatch: %v", small[i], n)
+ t.Errorf("small read %q mismatch: %v", small[i], n)
}
}
}
@@ -348,7 +348,7 @@ func TestSymLink(t *testing.T) {
t.Fatalf("stat %q failed: %v", from, err)
}
if !fromstat.FollowedSymlink {
- t.Fatalf("stat %q did not follow symlink")
+ t.Fatalf("stat %q did not follow symlink", from)
}
s, err := Readlink(from)
if err != nil {
diff --git a/src/pkg/os/path_test.go b/src/pkg/os/path_test.go
index 9bc92ae027..c662882a05 100644
--- a/src/pkg/os/path_test.go
+++ b/src/pkg/os/path_test.go
@@ -35,7 +35,7 @@ func TestMkdirAll(t *testing.T) {
// Can't make directory named after file.
err = MkdirAll(fpath, 0777)
if err == nil {
- t.Fatalf("MkdirAll %q: no error")
+ t.Fatalf("MkdirAll %q: no error", fpath)
}
perr, ok := err.(*PathError)
if !ok {
@@ -49,7 +49,7 @@ func TestMkdirAll(t *testing.T) {
ffpath := fpath + "/subdir"
err = MkdirAll(ffpath, 0777)
if err == nil {
- t.Fatalf("MkdirAll %q: no error")
+ t.Fatalf("MkdirAll %q: no error", ffpath)
}
perr, ok = err.(*PathError)
if !ok {
@@ -135,7 +135,7 @@ func TestRemoveAll(t *testing.T) {
if err == nil {
t.Errorf("Can lstat %q after supposed RemoveAll", path)
}
- t.Fatalf("RemoveAll %q succeeded with chmod 0 subdirectory", path, err)
+ t.Fatalf("RemoveAll %q succeeded with chmod 0 subdirectory: err %s", path, err)
}
perr, ok := err.(*PathError)
if !ok {
diff --git a/src/pkg/path/path_test.go b/src/pkg/path/path_test.go
index e00ac09729..971f32eb7a 100644
--- a/src/pkg/path/path_test.go
+++ b/src/pkg/path/path_test.go
@@ -257,7 +257,7 @@ func TestWalk(t *testing.T) {
errors := make(chan os.Error, 64)
Walk(tree.name, v, errors)
if err, ok := <-errors; ok {
- t.Errorf("no error expected, found: s", err)
+ t.Error("no error expected, found: s", err)
}
checkMarks(t)
diff --git a/src/pkg/reflect/all_test.go b/src/pkg/reflect/all_test.go
index 25e429a9d4..e745ab8afb 100644
--- a/src/pkg/reflect/all_test.go
+++ b/src/pkg/reflect/all_test.go
@@ -873,7 +873,7 @@ func TestMap(t *testing.T) {
// Check that value lookup is correct.
vv := mv.Elem(NewValue(k))
if vi := vv.(*IntValue).Get(); vi != int64(v) {
- t.Errorf("Key %q: have value %d, want %d", vi, v)
+ t.Errorf("Key %q: have value %d, want %d", k, vi, v)
}
// Copy into new map.
diff --git a/src/pkg/strconv/atob_test.go b/src/pkg/strconv/atob_test.go
index 7a95456214..497df5b18d 100644
--- a/src/pkg/strconv/atob_test.go
+++ b/src/pkg/strconv/atob_test.go
@@ -46,7 +46,7 @@ func TestAtob(t *testing.T) {
}
} else {
if e != nil {
- t.Errorf("%s: expected no error but got %s", test.in, test.err, e)
+ t.Errorf("%s: expected no error but got %s", test.in, e)
}
if b != test.out {
t.Errorf("%s: expected %t but got %t", test.in, test.out, b)
diff --git a/src/pkg/syslog/syslog_test.go b/src/pkg/syslog/syslog_test.go
index eeae1022ce..063ab71b44 100644
--- a/src/pkg/syslog/syslog_test.go
+++ b/src/pkg/syslog/syslog_test.go
@@ -47,7 +47,7 @@ func TestNew(t *testing.T) {
func TestNewLogger(t *testing.T) {
f := NewLogger(LOG_INFO, 0)
if f == nil {
- t.Errorf("NewLogger() failed")
+ t.Error("NewLogger() failed")
}
}
diff --git a/src/pkg/time/tick_test.go b/src/pkg/time/tick_test.go
index d089a9b98c..2a63a0f2b3 100644
--- a/src/pkg/time/tick_test.go
+++ b/src/pkg/time/tick_test.go
@@ -31,7 +31,7 @@ func TestTicker(t *testing.T) {
Sleep(2 * Delta)
_, received := <-ticker.C
if received {
- t.Fatalf("Ticker did not shut down")
+ t.Fatal("Ticker did not shut down")
}
}
diff --git a/src/pkg/unicode/maketables.go b/src/pkg/unicode/maketables.go
index 4c6d83f3e6..c8e7eb4420 100644
--- a/src/pkg/unicode/maketables.go
+++ b/src/pkg/unicode/maketables.go
@@ -329,7 +329,7 @@ func printCategories() {
for k, _ := range category {
fmt.Printf("\t%q: %s,\n", k, k)
}
- fmt.Printf("}\n\n")
+ fmt.Print("}\n\n")
}
decl := make(sort.StringArray, len(list))
@@ -377,7 +377,7 @@ func printCategories() {
for _, d := range decl {
fmt.Print(d)
}
- fmt.Println(")\n")
+ fmt.Print(")\n\n")
}
type Op func(code int) bool
@@ -597,7 +597,7 @@ func printScriptOrProperty(doProps bool) {
for k, _ := range table {
fmt.Printf("\t%q: %s,\n", k, k)
}
- fmt.Printf("}\n\n")
+ fmt.Print("}\n\n")
}
decl := make(sort.StringArray, len(list))
@@ -618,14 +618,14 @@ func printScriptOrProperty(doProps bool) {
for _, s := range ranges {
fmt.Printf(format, s.Lo, s.Hi, s.Stride)
}
- fmt.Printf("}\n\n")
+ fmt.Print("}\n\n")
}
decl.Sort()
fmt.Println("var (")
for _, d := range decl {
fmt.Print(d)
}
- fmt.Println(")\n")
+ fmt.Print(")\n\n")
}
const (
@@ -792,7 +792,7 @@ func printCases() {
}
prevState = state
}
- fmt.Printf("}\n")
+ fmt.Print("}\n")
}
func printCaseRange(lo, hi *caseState) {
diff --git a/src/pkg/utf8/string_test.go b/src/pkg/utf8/string_test.go
index 0733b061c1..9dd8472473 100644
--- a/src/pkg/utf8/string_test.go
+++ b/src/pkg/utf8/string_test.go
@@ -15,7 +15,7 @@ func TestScanForwards(t *testing.T) {
runes := []int(s)
str := NewString(s)
if str.RuneCount() != len(runes) {
- t.Error("%s: expected %d runes; got %d", s, len(runes), str.RuneCount())
+ t.Errorf("%s: expected %d runes; got %d", s, len(runes), str.RuneCount())
break
}
for i, expect := range runes {
@@ -32,7 +32,7 @@ func TestScanBackwards(t *testing.T) {
runes := []int(s)
str := NewString(s)
if str.RuneCount() != len(runes) {
- t.Error("%s: expected %d runes; got %d", s, len(runes), str.RuneCount())
+ t.Errorf("%s: expected %d runes; got %d", s, len(runes), str.RuneCount())
break
}
for i := len(runes) - 1; i >= 0; i-- {
@@ -55,7 +55,7 @@ func TestRandomAccess(t *testing.T) {
runes := []int(s)
str := NewString(s)
if str.RuneCount() != len(runes) {
- t.Error("%s: expected %d runes; got %d", s, len(runes), str.RuneCount())
+ t.Errorf("%s: expected %d runes; got %d", s, len(runes), str.RuneCount())
break
}
for j := 0; j < randCount; j++ {
@@ -77,7 +77,7 @@ func TestRandomSliceAccess(t *testing.T) {
runes := []int(s)
str := NewString(s)
if str.RuneCount() != len(runes) {
- t.Error("%s: expected %d runes; got %d", s, len(runes), str.RuneCount())
+ t.Errorf("%s: expected %d runes; got %d", s, len(runes), str.RuneCount())
break
}
for k := 0; k < randCount; k++ {
diff --git a/src/pkg/utf8/utf8_test.go b/src/pkg/utf8/utf8_test.go
index 59896aa656..7a1db93e55 100644
--- a/src/pkg/utf8/utf8_test.go
+++ b/src/pkg/utf8/utf8_test.go
@@ -166,7 +166,7 @@ func TestIntConversion(t *testing.T) {
for _, ts := range testStrings {
runes := []int(ts)
if RuneCountInString(ts) != len(runes) {
- t.Error("%q: expected %d runes; got %d", ts, len(runes), RuneCountInString(ts))
+ t.Errorf("%q: expected %d runes; got %d", ts, len(runes), RuneCountInString(ts))
break
}
i := 0
diff --git a/src/pkg/websocket/websocket_test.go b/src/pkg/websocket/websocket_test.go
index c66c114589..cc4b9dc189 100644
--- a/src/pkg/websocket/websocket_test.go
+++ b/src/pkg/websocket/websocket_test.go
@@ -155,7 +155,7 @@ func TestHTTP(t *testing.T) {
// specification, the server should abort the WebSocket connection.
_, _, err := http.Get(fmt.Sprintf("http://%s/echo", serverAddr))
if err == nil {
- t.Errorf("Get: unexpected success")
+ t.Error("Get: unexpected success")
return
}
urlerr, ok := err.(*http.URLError)
diff --git a/src/pkg/xml/xml_test.go b/src/pkg/xml/xml_test.go
index 00688969f2..2c73fcc803 100644
--- a/src/pkg/xml/xml_test.go
+++ b/src/pkg/xml/xml_test.go
@@ -301,7 +301,7 @@ func TestIssue569(t *testing.T) {
err := Unmarshal(buf, &i)
if err != nil || i.Field_a != "abcd" {
- t.Fatalf("Expecting abcd")
+ t.Fatal("Expecting abcd")
}
}