You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you set up a test with something like defer myval.AssertExpectations(t) and then later skip the test (t.Skip()), the AssertExpectations check can still fail your test. I propose that AssertExpectations should check whether the test has already been marked as "skipped" and, if so, return nil (success). Here's the change I'm envisioning:
typetSkippedinterface {
Skipped() bool
}
// AssertExpectations asserts that everything specified with On and Return was// in fact called as expected. Calls may have occurred in any order.func (m*Mock) AssertExpectations(tTestingT) bool {
ifs, ok:=t.(tSkipped); ok { // <--- START OF PROPOSED NEW CODEifs.Skipped() {
returntrue
}
} // <--- END OF PROPOSED NEW CODEifh, ok:=t.(tHelper); ok {
h.Helper()
}
m.mutex.Lock()
deferm.mutex.Unlock()
[...]
}
If y'all are in agreement with this, I'm very happy to create a PR.
The text was updated successfully, but these errors were encountered:
If you set up a test with something like
defer myval.AssertExpectations(t)
and then later skip the test (t.Skip()
), theAssertExpectations
check can still fail your test. I propose thatAssertExpectations
should check whether the test has already been marked as "skipped" and, if so, return nil (success). Here's the change I'm envisioning:If y'all are in agreement with this, I'm very happy to create a PR.
The text was updated successfully, but these errors were encountered: