Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

suite: add wrappers for Log and Logf functions #1553

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 16 additions & 0 deletions suite/suite.go
Expand Up @@ -77,6 +77,22 @@ func (suite *Suite) Assert() *assert.Assertions {
return suite.Assertions
}

// Logf wraps call to testing.T Logf function. This is erquivalent to calling
// s.T().Logf(format, args).
func (suite *Suite) Logf(format string, args ...interface{}) {
suite.mu.RLock()
defer suite.mu.RUnlock()
suite.T().Logf(format, args...)
fredrb marked this conversation as resolved.
Show resolved Hide resolved
}

// Log wraps call to testing.T Log function. This is erquivalent to calling
// s.T().Log(message).
func (suite *Suite) Log(args ...interface{}) {
suite.mu.RLock()
defer suite.mu.RUnlock()
suite.T().Log(args...)
fredrb marked this conversation as resolved.
Show resolved Hide resolved
}

func recoverAndFailOnPanic(t *testing.T) {
t.Helper()
r := recover()
Expand Down