mirror of https://github.com/stretchr/testify.git
Fix tests
parent
3efd733edb
commit
2696ec2b70
|
@ -165,15 +165,6 @@ type SuiteTester struct {
|
||||||
TimeAfter []time.Time
|
TimeAfter []time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
type SuiteSkipTester struct {
|
|
||||||
// Include our basic suite logic.
|
|
||||||
Suite
|
|
||||||
|
|
||||||
// Keep counts of how many times each method is run.
|
|
||||||
SetupSuiteRunCount int
|
|
||||||
TearDownSuiteRunCount int
|
|
||||||
}
|
|
||||||
|
|
||||||
// The SetupSuite method will be run by testify once, at the very
|
// The SetupSuite method will be run by testify once, at the very
|
||||||
// start of the testing suite, before any tests are run.
|
// start of the testing suite, before any tests are run.
|
||||||
func (suite *SuiteTester) SetupSuite() {
|
func (suite *SuiteTester) SetupSuite() {
|
||||||
|
@ -192,21 +183,12 @@ func (suite *SuiteTester) AfterTest(suiteName, testName string) {
|
||||||
suite.TimeAfter = append(suite.TimeAfter, time.Now())
|
suite.TimeAfter = append(suite.TimeAfter, time.Now())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *SuiteSkipTester) SetupSuite() {
|
|
||||||
suite.SetupSuiteRunCount++
|
|
||||||
suite.T().Skip()
|
|
||||||
}
|
|
||||||
|
|
||||||
// The TearDownSuite method will be run by testify once, at the very
|
// The TearDownSuite method will be run by testify once, at the very
|
||||||
// end of the testing suite, after all tests have been run.
|
// end of the testing suite, after all tests have been run.
|
||||||
func (suite *SuiteTester) TearDownSuite() {
|
func (suite *SuiteTester) TearDownSuite() {
|
||||||
suite.TearDownSuiteRunCount++
|
suite.TearDownSuiteRunCount++
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *SuiteSkipTester) TearDownSuite() {
|
|
||||||
suite.TearDownSuiteRunCount++
|
|
||||||
}
|
|
||||||
|
|
||||||
// The SetupTest method will be run before every test in the suite.
|
// The SetupTest method will be run before every test in the suite.
|
||||||
func (suite *SuiteTester) SetupTest() {
|
func (suite *SuiteTester) SetupTest() {
|
||||||
suite.SetupTestRunCount++
|
suite.SetupTestRunCount++
|
||||||
|
@ -268,6 +250,30 @@ func (suite *SuiteTester) TestSubtest() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SuiteSkipTester struct {
|
||||||
|
// Include our basic suite logic.
|
||||||
|
Suite
|
||||||
|
|
||||||
|
// Keep counts of how many times each method is run.
|
||||||
|
SetupSuiteRunCount int
|
||||||
|
TearDownSuiteRunCount int
|
||||||
|
}
|
||||||
|
|
||||||
|
func (suite *SuiteSkipTester) SetupSuite() {
|
||||||
|
suite.SetupSuiteRunCount++
|
||||||
|
suite.T().Skip()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (suite *SuiteSkipTester) TestNothing() {
|
||||||
|
// SetupSuite is only called when at least one test satisfies
|
||||||
|
// test filter. For this suite to be set up (and then tore down)
|
||||||
|
// it is necessary to add at least one test method.
|
||||||
|
}
|
||||||
|
|
||||||
|
func (suite *SuiteSkipTester) TearDownSuite() {
|
||||||
|
suite.TearDownSuiteRunCount++
|
||||||
|
}
|
||||||
|
|
||||||
// TestRunSuite will be run by the 'go test' command, so within it, we
|
// TestRunSuite will be run by the 'go test' command, so within it, we
|
||||||
// can run our suite using the Run(*testing.T, TestingSuite) function.
|
// can run our suite using the Run(*testing.T, TestingSuite) function.
|
||||||
func TestRunSuite(t *testing.T) {
|
func TestRunSuite(t *testing.T) {
|
||||||
|
|
Loading…
Reference in New Issue