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

changed dependency to interface #867

Merged
merged 4 commits into from Jan 29, 2020
Merged
Changes from 1 commit
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
14 changes: 11 additions & 3 deletions suite/suite.go
Expand Up @@ -16,21 +16,29 @@ import (
var allTestsFilter = func(_, _ string) (bool, error) { return true, nil }
var matchMethod = flag.String("testify.m", "", "regular expression to select tests of the testify suite to run")

type TestingT interface {
Run(name string, f func(t *testing.T)) bool
Helper()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't limit the interface unnecessarily. If I'm not mistaken, Helper() isn't used anywhere in Suite; would it not make sense to leave it out for now until absolutely necessary?


Errorf(format string, args ...interface{})
FailNow()
}

// Suite is a basic testing suite with methods for storing and
// retrieving the current *testing.T context.
type Suite struct {
*assert.Assertions
require *require.Assertions
t *testing.T
t TestingT
}

// T retrieves the current *testing.T context.
func (suite *Suite) T() *testing.T {
func (suite *Suite) T() TestingT {
return suite.t
}

// SetT sets the current *testing.T context.
func (suite *Suite) SetT(t *testing.T) {
func (suite *Suite) SetT(t TestingT) {
suite.t = t
suite.Assertions = assert.New(t)
suite.require = require.New(t)
Expand Down