Skip to content

Commit faba995

Browse files
Update query.go
1 parent 30283da commit faba995

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

query.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,12 @@ func (f QueryMatcherFunc) Match(expectedSQL, actualSQL string) error {
4242
// QueryMatcherRegexp is the default SQL query matcher
4343
// used by sqlmock. It parses expectedSQL to a regular
4444
// expression and attempts to match actualSQL.
45-
var QueryMatcherRegexp QueryMatcher = QueryMatcherFunc(func(expectedSQL, actualSQL string) error {
46-
if actual != "" and expect == "" {
47-
return fmt.Errorf("expectedSQL can't be empty")
48-
}
49-
45+
var QueryMatcherRegexp QueryMatcher = QueryMatcherFunc(func(expectedSQL, actualSQL string) error {
5046
expect := stripQuery(expectedSQL)
5147
actual := stripQuery(actualSQL)
48+
if actual != "" && expect == "" {
49+
return fmt.Errorf("expectedSQL can't be empty")
50+
}
5251
re, err := regexp.Compile(expect)
5352
if err != nil {
5453
return err

0 commit comments

Comments
 (0)