diff options
author | Wim <wim@42.be> | 2022-06-25 00:36:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-25 00:36:16 +0200 |
commit | 4649876956ab944d2a9ea8fc98c75dc8a9f5ef08 (patch) | |
tree | 0f32da8e492cabd8eca53de319e287e6c4791c5e /vendor/github.com/stretchr/testify/suite | |
parent | 5604d140e3bbf5c8f6c414b1427145a0c4e36bb4 (diff) | |
download | matterbridge-msglm-4649876956ab944d2a9ea8fc98c75dc8a9f5ef08.tar.gz matterbridge-msglm-4649876956ab944d2a9ea8fc98c75dc8a9f5ef08.tar.bz2 matterbridge-msglm-4649876956ab944d2a9ea8fc98c75dc8a9f5ef08.zip |
Update dependencies (#1851)
Diffstat (limited to 'vendor/github.com/stretchr/testify/suite')
-rw-r--r-- | vendor/github.com/stretchr/testify/suite/suite.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/vendor/github.com/stretchr/testify/suite/suite.go b/vendor/github.com/stretchr/testify/suite/suite.go index b9b5d1c5..1c402e8d 100644 --- a/vendor/github.com/stretchr/testify/suite/suite.go +++ b/vendor/github.com/stretchr/testify/suite/suite.go @@ -7,6 +7,7 @@ import ( "reflect" "regexp" "runtime/debug" + "sync" "testing" "time" @@ -21,17 +22,22 @@ var matchMethod = flag.String("testify.m", "", "regular expression to select tes // retrieving the current *testing.T context. type Suite struct { *assert.Assertions + mu sync.RWMutex require *require.Assertions t *testing.T } // T retrieves the current *testing.T context. func (suite *Suite) T() *testing.T { + suite.mu.RLock() + defer suite.mu.RUnlock() return suite.t } // SetT sets the current *testing.T context. func (suite *Suite) SetT(t *testing.T) { + suite.mu.Lock() + defer suite.mu.Unlock() suite.t = t suite.Assertions = assert.New(t) suite.require = require.New(t) @@ -39,6 +45,8 @@ func (suite *Suite) SetT(t *testing.T) { // Require returns a require context for suite. func (suite *Suite) Require() *require.Assertions { + suite.mu.Lock() + defer suite.mu.Unlock() if suite.require == nil { suite.require = require.New(suite.T()) } @@ -51,6 +59,8 @@ func (suite *Suite) Require() *require.Assertions { // assert.Assertions with require.Assertions), this method is provided so you // can call `suite.Assert().NoError()`. func (suite *Suite) Assert() *assert.Assertions { + suite.mu.Lock() + defer suite.mu.Unlock() if suite.Assertions == nil { suite.Assertions = assert.New(suite.T()) } |