We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 108200d commit 30283daCopy full SHA for 30283da
query.go
@@ -43,6 +43,10 @@ func (f QueryMatcherFunc) Match(expectedSQL, actualSQL string) error {
43
// used by sqlmock. It parses expectedSQL to a regular
44
// 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
+
50
expect := stripQuery(expectedSQL)
51
actual := stripQuery(actualSQL)
52
re, err := regexp.Compile(expect)
0 commit comments