Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
thekidder committed Sep 6, 2023
1 parent 028da16 commit 77f8144
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions suite/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ type SuiteTester struct {
SetupSubTestRunCount int
TearDownSubTestRunCount int

SetupSubTestNames []string
TearDownSubTestNames []string

SuiteNameBefore []string
TestNameBefore []string

Expand Down Expand Up @@ -260,16 +263,12 @@ func (suite *SuiteTester) TestSubtest() {
}

func (suite *SuiteTester) TearDownSubTest() {
subTestT := suite.T()
suite.NotEqual(subTestT, suite.SuiteT)

suite.TearDownSubTestNames = append(suite.TearDownSubTestNames, suite.T().Name())
suite.TearDownSubTestRunCount++
}

func (suite *SuiteTester) SetupSubTest() {
subTestT := suite.T()
suite.NotEqual(subTestT, suite.SuiteT)

suite.SetupSubTestNames = append(suite.SetupSubTestNames, suite.T().Name())
suite.SetupSubTestRunCount++
}

Expand Down Expand Up @@ -327,6 +326,12 @@ func TestRunSuite(t *testing.T) {
assert.Contains(t, suiteTester.TestNameBefore, "TestSkip")
assert.Contains(t, suiteTester.TestNameBefore, "TestSubtest")

assert.Contains(t, suiteTester.SetupSubTestNames, "TestRunSuite/TestSubtest/first")
assert.Contains(t, suiteTester.SetupSubTestNames, "TestRunSuite/TestSubtest/second")

assert.Contains(t, suiteTester.TearDownSubTestNames, "TestRunSuite/TestSubtest/first")
assert.Contains(t, suiteTester.TearDownSubTestNames, "TestRunSuite/TestSubtest/second")

for _, suiteName := range suiteTester.SuiteNameAfter {
assert.Equal(t, "SuiteTester", suiteName)
}
Expand Down

0 comments on commit 77f8144

Please sign in to comment.