mirror of https://github.com/stretchr/testify.git
test: testing.T correctness in subtests setup/teardown
parent
82022eeb0d
commit
855d1c6784
|
@ -242,8 +242,8 @@ func (suite *SuiteTester) TestSubtest() {
|
||||||
for _, t := range []struct {
|
for _, t := range []struct {
|
||||||
testName string
|
testName string
|
||||||
}{
|
}{
|
||||||
{"first"},
|
{"first-subtest"},
|
||||||
{"second"},
|
{"second-subtest"},
|
||||||
} {
|
} {
|
||||||
suiteT := suite.T()
|
suiteT := suite.T()
|
||||||
suite.Run(t.testName, func() {
|
suite.Run(t.testName, func() {
|
||||||
|
@ -259,10 +259,14 @@ func (suite *SuiteTester) TestSubtest() {
|
||||||
|
|
||||||
func (suite *SuiteTester) TearDownSubTest() {
|
func (suite *SuiteTester) TearDownSubTest() {
|
||||||
suite.TearDownSubTestRunCount++
|
suite.TearDownSubTestRunCount++
|
||||||
|
// We should get the *testing.T for the test that is to be torn down
|
||||||
|
suite.Contains(suite.T().Name(), "subtest")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *SuiteTester) SetupSubTest() {
|
func (suite *SuiteTester) SetupSubTest() {
|
||||||
suite.SetupSubTestRunCount++
|
suite.SetupSubTestRunCount++
|
||||||
|
// We should get the *testing.T for the test that is to be set up
|
||||||
|
suite.Contains(suite.T().Name(), "subtest")
|
||||||
}
|
}
|
||||||
|
|
||||||
type SuiteSkipTester struct {
|
type SuiteSkipTester struct {
|
||||||
|
|
Loading…
Reference in New Issue