mirror of
https://github.com/DATA-DOG/go-sqlmock.git
synced 2025-05-15 22:06:43 +02:00
Merge pull request #38 from jamiecuthill/master
Fixes issue with false positive on met expectations
This commit is contained in:
commit
55a0289da5
@ -231,7 +231,6 @@ func (c *sqlmock) Exec(query string, args []driver.Value) (res driver.Result, er
|
|||||||
}
|
}
|
||||||
|
|
||||||
defer expected.Unlock()
|
defer expected.Unlock()
|
||||||
expected.triggered = true
|
|
||||||
|
|
||||||
if !expected.queryMatches(query) {
|
if !expected.queryMatches(query) {
|
||||||
return nil, fmt.Errorf("exec query '%s', does not match regex '%s'", query, expected.sqlRegex.String())
|
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 {
|
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)
|
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
|
return expected.result, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user