mirror of
https://github.com/stretchr/testify.git
synced 2025-05-31 11:42:44 +00:00
Merge pull request #1710 from greg0ire/doc-goroutine-restriction
Document consequences of calling t.FailNow()
This commit is contained in:
commit
65f73866c0
@ -331,7 +331,10 @@ func (m *Mock) TestData() objx.Map {
|
|||||||
Setting expectations
|
Setting expectations
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Test sets the test struct variable of the mock object
|
// Test sets the [TestingT] on which errors will be reported, otherwise errors
|
||||||
|
// will cause a panic.
|
||||||
|
// Test should not be called on an object that is going to be used in a
|
||||||
|
// goroutine other than the one running the test function.
|
||||||
func (m *Mock) Test(t TestingT) {
|
func (m *Mock) Test(t TestingT) {
|
||||||
m.mutex.Lock()
|
m.mutex.Lock()
|
||||||
defer m.mutex.Unlock()
|
defer m.mutex.Unlock()
|
||||||
|
@ -23,6 +23,8 @@
|
|||||||
//
|
//
|
||||||
// The `require` package have same global functions as in the `assert` package,
|
// The `require` package have same global functions as in the `assert` package,
|
||||||
// but instead of returning a boolean result they call `t.FailNow()`.
|
// but instead of returning a boolean result they call `t.FailNow()`.
|
||||||
|
// A consequence of this is that it must be called from the goroutine running
|
||||||
|
// the test function, not from other goroutines created during the test.
|
||||||
//
|
//
|
||||||
// Every assertion function also takes an optional string message as the final argument,
|
// Every assertion function also takes an optional string message as the final argument,
|
||||||
// allowing custom error messages to be appended to the message the assertion method outputs.
|
// allowing custom error messages to be appended to the message the assertion method outputs.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user