diff --git a/reporter.go b/reporter.go index b66cd1c8f..954739b77 100644 --- a/reporter.go +++ b/reporter.go @@ -1,7 +1,6 @@ package httpexpect import ( - "fmt" "testing" "github.com/stretchr/testify/assert" @@ -21,7 +20,7 @@ func NewAssertReporter(t assert.TestingT) *AssertReporter { // Errorf implements Reporter.Errorf. func (r *AssertReporter) Errorf(message string, args ...interface{}) { - r.backend.Fail(fmt.Sprintf(message, args...)) + r.backend.Fail(message, args...) } // RequireReporter implements Reporter interface using `testify/require' @@ -37,7 +36,7 @@ func NewRequireReporter(t require.TestingT) *RequireReporter { // Errorf implements Reporter.Errorf. func (r *RequireReporter) Errorf(message string, args ...interface{}) { - r.backend.FailNow(fmt.Sprintf(message, args...)) + r.backend.FailNow(message, args...) } // FatalReporter is a struct that implements the Reporter interface @@ -47,8 +46,8 @@ type FatalReporter struct { } // NewFatalReporter returns a new FatalReporter object. -func NewFatalReporter(backend testing.TB) *FatalReporter { - return &FatalReporter{backend} +func NewFatalReporter(t testing.TB) *FatalReporter { + return &FatalReporter{t} } // Errorf implements Reporter.Errorf. diff --git a/reporter_test.go b/reporter_test.go index 14606ac1e..48e456420 100644 --- a/reporter_test.go +++ b/reporter_test.go @@ -15,11 +15,11 @@ func (m *mockT) Fatalf(format string, args ...interface{}) { m.fatalfInvoked = true } -func TestFatalReporter(t *testing.T) { +func TestReporter_FatalReporter(t *testing.T) { mockBackend := &mockT{} reporter := NewFatalReporter(mockBackend) - t.Run("Test Errorf", func(t *testing.T) { + t.Run("Errorf", func(t *testing.T) { reporter.Errorf("Test failed with backend: %v", mockBackend) assert.True(t, mockBackend.fatalfInvoked) })