File tree 1 file changed +25
-0
lines changed
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import (
10
10
"time"
11
11
12
12
"github.com/stretchr/testify/assert"
13
+ "github.com/stretchr/testify/mock"
13
14
"github.com/stretchr/testify/require"
14
15
)
15
16
@@ -482,3 +483,27 @@ func (s *CallOrderSuite) Test_A() {
482
483
func (s * CallOrderSuite ) Test_B () {
483
484
s .call ("Test B" )
484
485
}
486
+
487
+ func TestMockTCompatibility (t * testing.T ) {
488
+ suiteTester := new (SuiteTester )
489
+ suiteTester .SetT (t )
490
+
491
+ // compatible with mock.T
492
+ _ , ok := suiteTester .T ().(mock.TestingT )
493
+ assert .True (t , ok )
494
+
495
+ // compatible with testing.T
496
+ _ , ok = suiteTester .T ().(* testing.T )
497
+ assert .True (t , ok )
498
+
499
+ // compatible with testing.TB
500
+ _ , ok = suiteTester .T ().(testing.TB )
501
+ assert .True (t , ok )
502
+
503
+ // control check
504
+ type wrongInterface interface {
505
+ NotInSuiteT () string
506
+ }
507
+ _ , ok = suiteTester .T ().(wrongInterface )
508
+ assert .False (t , ok )
509
+ }
You can’t perform that action at this time.
0 commit comments