diff options
Diffstat (limited to 'internal')
-rw-r--r-- | internal/testhelpers/testhelpers.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/internal/testhelpers/testhelpers.go b/internal/testhelpers/testhelpers.go index 11bf7e65..2f708743 100644 --- a/internal/testhelpers/testhelpers.go +++ b/internal/testhelpers/testhelpers.go @@ -95,3 +95,13 @@ func PerformRequest(t *testing.T, handler http.Handler, r *http.Request) (int, s return res.StatusCode, string(b) } + +// Close will call the close function on a closer as part +// of the t.Cleanup function. +func Close(t *testing.T, c io.Closer) { + t.Helper() + + t.Cleanup(func() { + require.NoError(t, c.Close()) + }) +} |