summaryrefslogtreecommitdiffhomepage
path: root/pkg/ilist
diff options
context:
space:
mode:
authorTamir Duberstein <tamird@google.com>2019-04-09 05:16:29 -0700
committerShentubot <shentubot@google.com>2019-04-09 05:17:32 -0700
commitcf4ed408c355ffaaca92b574108815072572b872 (patch)
tree0d5b21418978b8e4e08d62bbe7d271271b0d4b41 /pkg/ilist
parent05979a7547fc645df2cf48f816e521d76f40f31d (diff)
Use (*testing.T).Helper to clean up test failures
PiperOrigin-RevId: 242647530 Change-Id: I1bf9ac1d664f452dc47ca670d408a73538cb482f
Diffstat (limited to 'pkg/ilist')
-rw-r--r--pkg/ilist/list_test.go15
1 files changed, 6 insertions, 9 deletions
diff --git a/pkg/ilist/list_test.go b/pkg/ilist/list_test.go
index 4bda570b6..f37946dc2 100644
--- a/pkg/ilist/list_test.go
+++ b/pkg/ilist/list_test.go
@@ -15,7 +15,6 @@
package ilist
import (
- "runtime"
"testing"
)
@@ -30,20 +29,20 @@ type direct struct {
}
func verifyEquality(t *testing.T, entries []testEntry, l *List) {
+ t.Helper()
+
i := 0
for it := l.Front(); it != nil; it = it.Next() {
e := it.(*testEntry)
if e != &entries[i] {
- _, file, line, _ := runtime.Caller(1)
- t.Errorf("Wrong entry at index (%s:%d): %v", file, line, i)
+ t.Errorf("Wrong entry at index %d", i)
return
}
i++
}
if i != len(entries) {
- _, file, line, _ := runtime.Caller(1)
- t.Errorf("Wrong number of entries (%s:%d)", file, line)
+ t.Errorf("Wrong number of entries; want = %d, got = %d", len(entries), i)
return
}
@@ -51,16 +50,14 @@ func verifyEquality(t *testing.T, entries []testEntry, l *List) {
for it := l.Back(); it != nil; it = it.Prev() {
e := it.(*testEntry)
if e != &entries[len(entries)-1-i] {
- _, file, line, _ := runtime.Caller(1)
- t.Errorf("Wrong entry at index (%s:%d): %v", file, line, i)
+ t.Errorf("Wrong entry at index %d", i)
return
}
i++
}
if i != len(entries) {
- _, file, line, _ := runtime.Caller(1)
- t.Errorf("Wrong number of entries (%s:%d)", file, line)
+ t.Errorf("Wrong number of entries; want = %d, got = %d", len(entries), i)
return
}
}