You've already forked go-sqlmock
mirror of
https://github.com/DATA-DOG/go-sqlmock.git
synced 2025-06-23 00:17:47 +02:00
added tests
This commit is contained in:
@ -99,3 +99,20 @@ func TestQueryExpectationArgComparisonBool(t *testing.T) {
|
||||
t.Error("arguments should not match, since argument is different")
|
||||
}
|
||||
}
|
||||
|
||||
type panicConverter struct {
|
||||
}
|
||||
|
||||
func (s panicConverter) ConvertValue(v interface{}) (driver.Value, error) {
|
||||
panic(v)
|
||||
}
|
||||
|
||||
func Test_queryBasedExpectation_attemptArgMatch(t *testing.T) {
|
||||
e := &queryBasedExpectation{converter: new(panicConverter), args: []driver.Value{"test"}}
|
||||
values := []namedValue{
|
||||
{Ordinal: 1, Name: "test", Value: "test"},
|
||||
}
|
||||
if err := e.attemptArgMatch(values); err == nil {
|
||||
t.Errorf("error expected")
|
||||
}
|
||||
}
|
||||
|
@ -155,3 +155,20 @@ func TestQueryExpectationNamedArgComparison(t *testing.T) {
|
||||
t.Errorf("arguments should have matched, but it did not: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
type panicConverter struct {
|
||||
}
|
||||
|
||||
func (s panicConverter) ConvertValue(v interface{}) (driver.Value, error) {
|
||||
panic(v)
|
||||
}
|
||||
|
||||
func Test_queryBasedExpectation_attemptArgMatch(t *testing.T) {
|
||||
e := &queryBasedExpectation{converter: new(panicConverter), args: []driver.Value{"test"}}
|
||||
values := []driver.NamedValue{
|
||||
{Ordinal: 1, Name: "test", Value: "test"},
|
||||
}
|
||||
if err := e.attemptArgMatch(values); err == nil {
|
||||
t.Errorf("error expected")
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user