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

Conversation

fredrb
Copy link

@fredrb fredrb commented Feb 29, 2024

Summary

Introduce wrapper methods for testing.T Log and Logf methods.

Changes

  • Add suite.Log method
  • Add suite.Logf method

Motivation

I frequently use t.Log and t.Logf to add verbose log to my tests, usually while I'm still creating them. Therefore, I find myself often writting the following snippet:

func (s *mySuite) TestA() {
        s.T().Logf(...)
}

Example usage

For that reason, it would be a nice improvement if the suite struct implemented wrappers to these functions, so I could write instead:

func (s *mySuite) TestA() {
        s.Logf(...)
}

Related issues

None.

@fredrb fredrb changed the title write wrapper for Log and Logf functions Suite wrapper for Log and Logf functions Feb 29, 2024
@brackendawson brackendawson added the pkg-suite Change related to package testify/suite label Feb 29, 2024
suite/suite.go Outdated Show resolved Hide resolved
suite/suite.go Outdated Show resolved Hide resolved
@dolmen dolmen added the revisit label Mar 5, 2024
@dolmen dolmen changed the title Suite wrapper for Log and Logf functions suite: add wrappers for Log and Logf functions Mar 6, 2024
@fredrb fredrb requested a review from dolmen March 6, 2024 08:17
@fredrb
Copy link
Author

fredrb commented Mar 13, 2024

@dolmen could you please take a look if this change is good to be merged? Do you have any other concerns about doing this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement pkg-suite Change related to package testify/suite revisit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants