{"action":"opened","issue":{"url":"https://api.github.com/repos/DATA-DOG/go-sqlmock/issues/37","repository_url":"https://api.github.com/repos/DATA-DOG/go-sqlmock","labels_url":"https://api.github.com/repos/DATA-DOG/go-sqlmock/issues/37/labels{/name}","comments_url":"https://api.github.com/repos/DATA-DOG/go-sqlmock/issues/37/comments","events_url":"https://api.github.com/repos/DATA-DOG/go-sqlmock/issues/37/events","html_url":"https://github.com/DATA-DOG/go-sqlmock/issues/37","id":136672153,"number":37,"title":"False positive in ExpectationsWereMet","user":{"login":"jamiecuthill","id":779188,"avatar_url":"https://avatars.githubusercontent.com/u/779188?v=3","gravatar_id":"","url":"https://api.github.com/users/jamiecuthill","html_url":"https://github.com/jamiecuthill","followers_url":"https://api.github.com/users/jamiecuthill/followers","following_url":"https://api.github.com/users/jamiecuthill/following{/other_user}","gists_url":"https://api.github.com/users/jamiecuthill/gists{/gist_id}","starred_url":"https://api.github.com/users/jamiecuthill/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamiecuthill/subscriptions","organizations_url":"https://api.github.com/users/jamiecuthill/orgs","repos_url":"https://api.github.com/users/jamiecuthill/repos","events_url":"https://api.github.com/users/jamiecuthill/events{/privacy}","received_events_url":"https://api.github.com/users/jamiecuthill/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-26T11:32:46Z","updated_at":"2016-02-26T11:32:46Z","closed_at":null,"body":"We have noticed a false positive problem when asking if the `ExpectationsWereMet` with `MatchExpectationsInOrder = true`, when expecting `Exec` calls against the database. \r\n\r\n**The problem is not in the order matching, but that outstanding expectations have not been satisfied.**\r\n\r\n[Here is an example](https://gist.github.com/jamiecuthill/2497abae37586a9d4fff). 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.\r\n\r\nTested on version 3769fed7391131b7e0316a1f653d1ebc6d80ca2f\r\n\r\n---\r\n\r\nWe think the culprit is that the expectation matched in `Exec` has `triggered = true` before the query is matched. This currently happens on [line 234](https://github.com/DATA-DOG/go-sqlmock/blob/master/sqlmock.go#L234). Moving this to just above [line 251](https://github.com/DATA-DOG/go-sqlmock/blob/master/sqlmock.go#L251) resolves the issue."}}