Skip to content

Commit 5e72f93

Browse files
committed
Remove timestamp from callback
1 parent bf7a93e commit 5e72f93

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

suite/interfaces.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
package suite
22

3-
import (
4-
"testing"
5-
"time"
6-
)
3+
import "testing"
74

85
// TestingSuite can store and return the current *testing.T context
96
// generated by 'go test'.
@@ -39,11 +36,11 @@ type TearDownTestSuite interface {
3936
// BeforeTest has a function to be executed right before the test
4037
// starts and receives the suite and test names as input
4138
type BeforeTest interface {
42-
BeforeTest(suiteName, testName string, when time.Time)
39+
BeforeTest(suiteName, testName string)
4340
}
4441

4542
// AfterTest has a function to be executed right after the test
4643
// finishes and receives the suite and test names as input
4744
type AfterTest interface {
48-
AfterTest(suiteName, testName string, when time.Time)
45+
AfterTest(suiteName, testName string)
4946
}

suite/suite.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
"reflect"
88
"regexp"
99
"testing"
10-
"time"
1110

1211
"github.com/stretchr/testify/assert"
1312
"github.com/stretchr/testify/require"
@@ -88,11 +87,11 @@ func Run(t *testing.T, suite TestingSuite) {
8887
setupTestSuite.SetupTest()
8988
}
9089
if beforeTestSuite, ok := suite.(BeforeTest); ok {
91-
beforeTestSuite.BeforeTest(methodFinder.Elem().Name(), method.Name, time.Now())
90+
beforeTestSuite.BeforeTest(methodFinder.Elem().Name(), method.Name)
9291
}
9392
defer func() {
9493
if afterTestSuite, ok := suite.(AfterTest); ok {
95-
afterTestSuite.AfterTest(methodFinder.Elem().Name(), method.Name, time.Now())
94+
afterTestSuite.AfterTest(methodFinder.Elem().Name(), method.Name)
9695
}
9796
if tearDownTestSuite, ok := suite.(TearDownTestSuite); ok {
9897
tearDownTestSuite.TearDownTest()

suite/suite_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,16 +85,16 @@ func (suite *SuiteTester) SetupSuite() {
8585
suite.SetupSuiteRunCount++
8686
}
8787

88-
func (suite *SuiteTester) BeforeTest(suiteName, testName string, when time.Time) {
88+
func (suite *SuiteTester) BeforeTest(suiteName, testName string) {
8989
suite.SuiteNameBefore = append(suite.SuiteNameBefore, suiteName)
9090
suite.TestNameBefore = append(suite.TestNameBefore, testName)
91-
suite.TimeBefore = append(suite.TimeBefore, when)
91+
suite.TimeBefore = append(suite.TimeBefore, time.Now())
9292
}
9393

94-
func (suite *SuiteTester) AfterTest(suiteName, testName string, when time.Time) {
94+
func (suite *SuiteTester) AfterTest(suiteName, testName string) {
9595
suite.SuiteNameAfter = append(suite.SuiteNameAfter, suiteName)
9696
suite.TestNameAfter = append(suite.TestNameAfter, testName)
97-
suite.TimeAfter = append(suite.TimeAfter, when)
97+
suite.TimeAfter = append(suite.TimeAfter, time.Now())
9898
}
9999

100100
func (suite *SuiteSkipTester) SetupSuite() {

0 commit comments

Comments
 (0)