Skip to content

Commit 3ebf1dd

Browse files
Revert PR #867
1 parent 624f997 commit 3ebf1dd

File tree

3 files changed

+7
-40
lines changed

3 files changed

+7
-40
lines changed

suite/interfaces.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
package suite
22

3+
import "testing"
4+
35
// TestingSuite can store and return the current *testing.T context
46
// generated by 'go test'.
57
type TestingSuite interface {
6-
T() TestingT
7-
SetT(TestingT)
8+
T() *testing.T
9+
SetT(*testing.T)
810
}
911

1012
// SetupAllSuite has a SetupSuite method, which will run before the

suite/suite.go

+3-13
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,21 @@ import (
1717
var allTestsFilter = func(_, _ string) (bool, error) { return true, nil }
1818
var matchMethod = flag.String("testify.m", "", "regular expression to select tests of the testify suite to run")
1919

20-
type TestingT interface {
21-
Run(name string, f func(t *testing.T)) bool
22-
Errorf(format string, args ...interface{})
23-
Fatalf(format string, args ...interface{})
24-
FailNow()
25-
Log(args ...interface{})
26-
Logf(format string, args ...interface{})
27-
Skip(args ...interface{})
28-
}
29-
3020
// Suite is a basic testing suite with methods for storing and
3121
// retrieving the current *testing.T context.
3222
type Suite struct {
3323
*assert.Assertions
3424
require *require.Assertions
35-
t TestingT
25+
t *testing.T
3626
}
3727

3828
// T retrieves the current *testing.T context.
39-
func (suite *Suite) T() TestingT {
29+
func (suite *Suite) T() *testing.T {
4030
return suite.t
4131
}
4232

4333
// SetT sets the current *testing.T context.
44-
func (suite *Suite) SetT(t TestingT) {
34+
func (suite *Suite) SetT(t *testing.T) {
4535
suite.t = t
4636
suite.Assertions = assert.New(t)
4737
suite.require = require.New(t)

suite/suite_test.go

-25
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"time"
1111

1212
"github.com/stretchr/testify/assert"
13-
"github.com/stretchr/testify/mock"
1413
"github.com/stretchr/testify/require"
1514
)
1615

@@ -483,27 +482,3 @@ func (s *CallOrderSuite) Test_A() {
483482
func (s *CallOrderSuite) Test_B() {
484483
s.call("Test B")
485484
}
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-
}

0 commit comments

Comments
 (0)