Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive in ExpectationsWereMet #37

Closed
jamiecuthill opened this issue Feb 26, 2016 · 0 comments · Fixed by #38
Closed

False positive in ExpectationsWereMet #37

jamiecuthill opened this issue Feb 26, 2016 · 0 comments · Fixed by #38

Comments

@jamiecuthill
Copy link
Contributor

We have noticed a false positive problem when asking if the ExpectationsWereMet with MatchExpectationsInOrder = true, when expecting Exec calls against the database.

The problem is not in the order matching, but that outstanding expectations have not been satisfied.

Here is an example. Both the tests in sqlexec_test.go should be failing because RunExecs second call to Exec is not expected and as such one of our expected Exec calls has not been satisfied. The first test, where MatchExpectationsInOrder = true, is passing - it should not.

Tested on version 3769fed


We think the culprit is that the expectation matched in Exec has triggered = true before the query is matched. This currently happens on line 234. Moving this to just above line 251 resolves the issue.

l3pp4rd added a commit that referenced this issue Feb 26, 2016
JonathanHarford pushed a commit to LIVEauctioneers/go-sqlmock that referenced this issue Feb 29, 2016
…ouldRespondWithErrorOnFailure` in `/examples/blog/blog_test.go` no longer passed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant