From 02dbf6d6d5b263398b20f1f22930dfe25959804e Mon Sep 17 00:00:00 2001 From: Daniel Bennett Date: Fri, 14 Jun 2024 17:15:36 -0400 Subject: [PATCH] mark more internal funcs as helpers --- assert.go | 1 + invocations.go | 2 ++ must/assert.go | 1 + must/invocations.go | 2 ++ 4 files changed, 6 insertions(+) diff --git a/assert.go b/assert.go index e608311..92094b7 100644 --- a/assert.go +++ b/assert.go @@ -11,5 +11,6 @@ type T interface { } func errorf(t T, msg string, args ...any) { + t.Helper() t.Errorf(msg, args...) } diff --git a/invocations.go b/invocations.go index 6bc0a70..7842808 100644 --- a/invocations.go +++ b/invocations.go @@ -15,12 +15,14 @@ func passing(result string) bool { } func fail(t T, msg string, scripts ...PostScript) { + t.Helper() c := assertions.Caller() s := c + msg + "\n" + run(scripts...) errorf(t, "\n"+strings.TrimSpace(s)+"\n") } func invoke(t T, result string, settings ...Setting) { + t.Helper() result = strings.TrimSpace(result) if !passing(result) { fail(t, result, scripts(settings...)...) diff --git a/must/assert.go b/must/assert.go index f9ff76f..ec1f0a0 100644 --- a/must/assert.go +++ b/must/assert.go @@ -11,5 +11,6 @@ type T interface { } func errorf(t T, msg string, args ...any) { + t.Helper() t.Fatalf(msg, args...) } diff --git a/must/invocations.go b/must/invocations.go index 80b5a65..582d4ea 100644 --- a/must/invocations.go +++ b/must/invocations.go @@ -17,12 +17,14 @@ func passing(result string) bool { } func fail(t T, msg string, scripts ...PostScript) { + t.Helper() c := assertions.Caller() s := c + msg + "\n" + run(scripts...) errorf(t, "\n"+strings.TrimSpace(s)+"\n") } func invoke(t T, result string, settings ...Setting) { + t.Helper() result = strings.TrimSpace(result) if !passing(result) { fail(t, result, scripts(settings...)...)