mirror of
https://github.com/DATA-DOG/go-sqlmock.git
synced 2025-05-15 22:06:43 +02:00
Update query.go
This commit is contained in:
parent
30283daf08
commit
faba995e99
7
query.go
7
query.go
@ -43,12 +43,11 @@ func (f QueryMatcherFunc) Match(expectedSQL, actualSQL string) error {
|
|||||||
// used by sqlmock. It parses expectedSQL to a regular
|
// used by sqlmock. It parses expectedSQL to a regular
|
||||||
// expression and attempts to match actualSQL.
|
// expression and attempts to match actualSQL.
|
||||||
var QueryMatcherRegexp QueryMatcher = QueryMatcherFunc(func(expectedSQL, actualSQL string) error {
|
var QueryMatcherRegexp QueryMatcher = QueryMatcherFunc(func(expectedSQL, actualSQL string) error {
|
||||||
if actual != "" and expect == "" {
|
|
||||||
return fmt.Errorf("expectedSQL can't be empty")
|
|
||||||
}
|
|
||||||
|
|
||||||
expect := stripQuery(expectedSQL)
|
expect := stripQuery(expectedSQL)
|
||||||
actual := stripQuery(actualSQL)
|
actual := stripQuery(actualSQL)
|
||||||
|
if actual != "" && expect == "" {
|
||||||
|
return fmt.Errorf("expectedSQL can't be empty")
|
||||||
|
}
|
||||||
re, err := regexp.Compile(expect)
|
re, err := regexp.Compile(expect)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
x
Reference in New Issue
Block a user