Add test on suite setup skipping

pull/731/head
Tigran Saluev 2019-02-10 23:11:55 +03:00 committed by George Lesica
parent af4cbaf11d
commit 943c6e8f43
1 changed files with 28 additions and 1 deletions

View File

@ -265,7 +265,7 @@ func (suite *SuiteSkipTester) SetupSuite() {
}
func (suite *SuiteSkipTester) TestNothing() {
// SetupSuite() is only called when at least one test satisfies
// 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.
}
@ -346,6 +346,33 @@ func TestRunSuite(t *testing.T) {
}
// This suite has no Test... methods. It's setup and teardown must be skipped.
type SuiteSetupSkipTester struct {
Suite
setUp bool
toreDown bool
}
func (s *SuiteSetupSkipTester) SetupSuite() {
s.setUp = true
}
func (s *SuiteSetupSkipTester) NonTestMethod() {
}
func (s *SuiteSetupSkipTester) TearDownSuite() {
s.toreDown = true
}
func TestSkippingSuiteSetup(t *testing.T) {
suiteTester := new(SuiteSetupSkipTester)
Run(t, suiteTester)
assert.False(t, suiteTester.setUp)
assert.False(t, suiteTester.toreDown)
}
func TestSuiteGetters(t *testing.T) {
suite := new(SuiteTester)
suite.SetT(t)