1
0
mirror of https://github.com/zhashkevych/go-sqlxmock.git synced 2024-11-24 08:12:13 +02:00

Merge pull request #38 from jamiecuthill/master

Fixes issue with false positive on met expectations
This commit is contained in:
Gediminas Morkevicius 2016-02-26 12:27:59 +00:00
commit 55a0289da5

View File

@ -231,7 +231,6 @@ func (c *sqlmock) Exec(query string, args []driver.Value) (res driver.Result, er
}
defer expected.Unlock()
expected.triggered = true
if !expected.queryMatches(query) {
return nil, fmt.Errorf("exec query '%s', does not match regex '%s'", query, expected.sqlRegex.String())
@ -248,6 +247,7 @@ func (c *sqlmock) Exec(query string, args []driver.Value) (res driver.Result, er
if expected.result == nil {
return nil, fmt.Errorf("exec query '%s' with args %+v, must return a database/sql/driver.result, but it was not set for expectation %T as %+v", query, args, expected, expected)
}
expected.triggered = true
return expected.result, err
}