mirror of
https://github.com/zhashkevych/go-sqlxmock.git
synced 2024-11-16 17:41:57 +02:00
added tests
This commit is contained in:
parent
5dc976bc43
commit
594a047e2f
@ -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")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user