cleanup: Adds t.Helper() to test helper function

This commit adds t.Helper() to the test helper
function. With this call go test prints correct
lines of code for failed tests. Otherwise,
printed lines will be inside helpers functions.
For more details check: https://github.com/kulti/thelper

Updates: #1586

Signed-off-by: Yati Padia <ypadia@redhat.com>
This commit is contained in:
Yati Padia 2021-07-11 12:11:39 +05:30 committed by mergify[bot]
parent 84c1fe52c7
commit f35ce3d880

View File

@ -24,12 +24,14 @@ import (
) )
func checkError(t *testing.T, msg string, err error) { func checkError(t *testing.T, msg string, err error) {
t.Helper()
if err == nil { if err == nil {
t.Errorf(msg) t.Errorf(msg)
} }
} }
func checkAndReportError(t *testing.T, msg string, err error) { func checkAndReportError(t *testing.T, msg string, err error) {
t.Helper()
if err != nil { if err != nil {
t.Errorf("%s (%v)", msg, err) t.Errorf("%s (%v)", msg, err)
} }