Skip to content

Commit 30283da

Browse files
Update query.go
1 parent 108200d commit 30283da

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

query.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ func (f QueryMatcherFunc) Match(expectedSQL, actualSQL string) error {
4343
// used by sqlmock. It parses expectedSQL to a regular
4444
// expression and attempts to match actualSQL.
4545
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+
4650
expect := stripQuery(expectedSQL)
4751
actual := stripQuery(actualSQL)
4852
re, err := regexp.Compile(expect)

0 commit comments

Comments
 (0)