Skip to content

Commit 594a047

Browse files
author
Nikita Koryabkin
committed
added tests
1 parent 5dc976b commit 594a047

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

expectations_before_go18_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,20 @@ func TestQueryExpectationArgComparisonBool(t *testing.T) {
9999
t.Error("arguments should not match, since argument is different")
100100
}
101101
}
102+
103+
type panicConverter struct {
104+
}
105+
106+
func (s panicConverter) ConvertValue(v interface{}) (driver.Value, error) {
107+
panic(v)
108+
}
109+
110+
func Test_queryBasedExpectation_attemptArgMatch(t *testing.T) {
111+
e := &queryBasedExpectation{converter: new(panicConverter), args: []driver.Value{"test"}}
112+
values := []namedValue{
113+
{Ordinal: 1, Name: "test", Value: "test"},
114+
}
115+
if err := e.attemptArgMatch(values); err == nil {
116+
t.Errorf("error expected")
117+
}
118+
}

expectations_go18_test.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,20 @@ func TestQueryExpectationNamedArgComparison(t *testing.T) {
155155
t.Errorf("arguments should have matched, but it did not: %v", err)
156156
}
157157
}
158+
159+
type panicConverter struct {
160+
}
161+
162+
func (s panicConverter) ConvertValue(v interface{}) (driver.Value, error) {
163+
panic(v)
164+
}
165+
166+
func Test_queryBasedExpectation_attemptArgMatch(t *testing.T) {
167+
e := &queryBasedExpectation{converter: new(panicConverter), args: []driver.Value{"test"}}
168+
values := []driver.NamedValue{
169+
{Ordinal: 1, Name: "test", Value: "test"},
170+
}
171+
if err := e.attemptArgMatch(values); err == nil {
172+
t.Errorf("error expected")
173+
}
174+
}

0 commit comments

Comments
 (0)