diff --git a/is/error.go b/is/error.go index 9249a66..d3d92d6 100644 --- a/is/error.go +++ b/is/error.go @@ -32,6 +32,8 @@ func Error(got, target error) expect.Expectation { // NoError expects v to be nil. func NoError(v error) expect.Expectation { return expect.ExpectFunc(func(t expect.TB) { + t.Helper() + if v != nil { t.Errorf("expected no error but got %q", v) } diff --git a/is/map.go b/is/map.go index 4499d77..0569f52 100644 --- a/is/map.go +++ b/is/map.go @@ -22,6 +22,8 @@ func MapContaining[T ~map[K]V, K, V comparable](got T, key K, val V) expect.Expe // MapOfLen expects got to contain want elements. func MapOfLen[T ~map[K]V, K comparable, V any](got T, want int) expect.Expectation { return expect.ExpectFunc(func(t expect.TB) { + t.Helper() + gotLen := len(got) if gotLen != want { t.Errorf("expected %v to have len %d but got %d", got, want, gotLen) diff --git a/is/string.go b/is/string.go index 619376f..8626293 100644 --- a/is/string.go +++ b/is/string.go @@ -9,6 +9,8 @@ import ( // StringOfLen expects got to have byte length want. func StringOfLen(got string, want int) expect.Expectation { return expect.ExpectFunc(func(t expect.TB) { + t.Helper() + gotLen := len(got) if gotLen != want { t.Errorf("expected %q to have len %d but got %d", got, want, gotLen)