-
Notifications
You must be signed in to change notification settings - Fork 16
/
runner_test.go
114 lines (108 loc) · 2.79 KB
/
runner_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
package proteus
import (
"context"
"database/sql"
"reflect"
"testing"
"github.com/jonbodner/proteus/logger"
"github.com/jonbodner/proteus/mapper"
)
func Test_getQArgs(t *testing.T) {
type args struct {
args []reflect.Value
qps []paramInfo
}
tests := []struct {
name string
args args
want []interface{}
wantErr bool
}{
// TODO: Add test cases.
}
c := logger.WithLevel(context.Background(), logger.DEBUG)
for _, tt := range tests {
got, err := buildQueryArgs(c, tt.args.args, tt.args.qps)
if (err != nil) != tt.wantErr {
t.Errorf("%q. buildQueryArgs() error = %v, wantErr %v", tt.name, err, tt.wantErr)
continue
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("%q. buildQueryArgs() = %v, want %v", tt.name, got, tt.want)
}
}
}
func Test_buildExec(t *testing.T) {
type args struct {
funcType reflect.Type
qps []paramInfo
positionalQuery queryHolder
}
tests := []struct {
name string
args args
want func(args []reflect.Value) []reflect.Value
wantErr bool
}{
// TODO: Add test cases.
}
c := logger.WithLevel(context.Background(), logger.DEBUG)
for _, tt := range tests {
got := makeExecutorImplementation(c, tt.args.funcType, tt.args.positionalQuery, tt.args.qps)
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("%q. makeExecutorImplementation() = %T, want %T", tt.name, got, tt.want)
}
}
}
func Test_buildQuery(t *testing.T) {
type args struct {
funcType reflect.Type
qps []paramInfo
positionalQuery queryHolder
}
tests := []struct {
name string
args args
want func(args []reflect.Value) []reflect.Value
wantErr bool
}{
// TODO: Add test cases.
}
c := logger.WithLevel(context.Background(), logger.DEBUG)
for _, tt := range tests {
got, err := makeQuerierImplementation(c, tt.args.funcType, tt.args.positionalQuery, tt.args.qps)
if (err != nil) != tt.wantErr {
t.Errorf("%q. makeQuerierImplementation() error = %v, wantErr %v", tt.name, err, tt.wantErr)
continue
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("%q. makeQuerierImplementation() = %T, want %T", tt.name, got, tt.want)
}
}
}
func Test_handleMapping(t *testing.T) {
type args struct {
sType reflect.Type
rows *sql.Rows
builder mapper.Builder
}
tests := []struct {
name string
args args
want interface{}
wantErr bool
}{
// TODO: Add test cases.
}
c := logger.WithLevel(context.Background(), logger.DEBUG)
for _, tt := range tests {
got, err := handleMapping(c, tt.args.sType, tt.args.rows, tt.args.builder)
if (err != nil) != tt.wantErr {
t.Errorf("%q. handleMapping() error = %v, wantErr %v", tt.name, err, tt.wantErr)
continue
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("%q. handleMapping() = %v, want %v", tt.name, got, tt.want)
}
}
}