You've already forked go-sqlmock
mirror of
https://github.com/DATA-DOG/go-sqlmock.git
synced 2025-07-03 00:36:52 +02:00
use configured QueryMatcher in order to match expected SQL to actual, closes #70
This commit is contained in:
@ -3,7 +3,6 @@ package sqlmock
|
||||
import (
|
||||
"database/sql/driver"
|
||||
"fmt"
|
||||
"regexp"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
@ -100,20 +99,6 @@ func TestQueryExpectationArgComparisonBool(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestQueryExpectationSqlMatch(t *testing.T) {
|
||||
e := &ExpectedExec{}
|
||||
|
||||
e.sqlRegex = regexp.MustCompile("SELECT x FROM")
|
||||
if !e.queryMatches("SELECT x FROM someting") {
|
||||
t.Errorf("Sql must have matched the query")
|
||||
}
|
||||
|
||||
e.sqlRegex = regexp.MustCompile("SELECT COUNT\\(x\\) FROM")
|
||||
if !e.queryMatches("SELECT COUNT(x) FROM someting") {
|
||||
t.Errorf("Sql must have matched the query")
|
||||
}
|
||||
}
|
||||
|
||||
func ExampleExpectedExec() {
|
||||
db, mock, _ := New()
|
||||
result := NewErrorResult(fmt.Errorf("some error"))
|
||||
|
Reference in New Issue
Block a user