File tree Expand file tree Collapse file tree 2 files changed +12
-13
lines changed Expand file tree Collapse file tree 2 files changed +12
-13
lines changed Original file line number Diff line number Diff line change @@ -16,26 +16,30 @@ type TestInformation struct {
16
16
}
17
17
18
18
func newSuiteInformation () * SuiteInformation {
19
- testStats := make (map [string ]* TestInformation )
20
-
21
19
return & SuiteInformation {
22
- TestStats : testStats ,
20
+ TestStats : make ( map [ string ] * TestInformation ) ,
23
21
}
24
22
}
25
23
26
- func (s SuiteInformation ) start (testName string ) {
24
+ func (s * SuiteInformation ) start (testName string ) {
25
+ if s == nil {
26
+ return
27
+ }
27
28
s .TestStats [testName ] = & TestInformation {
28
29
TestName : testName ,
29
30
Start : time .Now (),
30
31
}
31
32
}
32
33
33
- func (s SuiteInformation ) end (testName string , passed bool ) {
34
+ func (s * SuiteInformation ) end (testName string , passed bool ) {
35
+ if s == nil {
36
+ return
37
+ }
34
38
s .TestStats [testName ].End = time .Now ()
35
39
s .TestStats [testName ].Passed = passed
36
40
}
37
41
38
- func (s SuiteInformation ) Passed () bool {
42
+ func (s * SuiteInformation ) Passed () bool {
39
43
for _ , stats := range s .TestStats {
40
44
if ! stats .Passed {
41
45
return false
Original file line number Diff line number Diff line change @@ -161,10 +161,7 @@ func Run(t *testing.T, suite TestingSuite) {
161
161
162
162
r := recover ()
163
163
164
- if stats != nil {
165
- passed := ! t .Failed () && r == nil
166
- stats .end (method .Name , passed )
167
- }
164
+ stats .end (method .Name , ! t .Failed () && r == nil )
168
165
169
166
if afterTestSuite , ok := suite .(AfterTest ); ok {
170
167
afterTestSuite .AfterTest (suiteName , method .Name )
@@ -185,9 +182,7 @@ func Run(t *testing.T, suite TestingSuite) {
185
182
beforeTestSuite .BeforeTest (methodFinder .Elem ().Name (), method .Name )
186
183
}
187
184
188
- if stats != nil {
189
- stats .start (method .Name )
190
- }
185
+ stats .start (method .Name )
191
186
192
187
method .Func .Call ([]reflect.Value {reflect .ValueOf (suite )})
193
188
},
You can’t perform that action at this time.
0 commit comments