mirror of
https://github.com/golang/go
synced 2024-11-20 09:14:46 -07:00
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
This commit is contained in:
parent
ab7884da7e
commit
1ce6245d6c
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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 {
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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))
|
||||
|
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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)
|
||||
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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++ {
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user