forked from go-zoo/bone
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelper_17_test.go
72 lines (69 loc) · 1.37 KB
/
helper_17_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
package bone
import (
"net/http"
"reflect"
"regexp"
"testing"
)
func TestGetAllValues(t *testing.T) {
type args struct {
req *http.Request
}
tests := []struct {
name string
args args
want map[string]string
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := GetAllValues(tt.args.req); !reflect.DeepEqual(got, tt.want) {
t.Errorf("GetAllValues() = %v, want %v", got, tt.want)
}
})
}
}
func TestRoute_serveMatchedRequest(t *testing.T) {
type fields struct {
Path string
Method string
Size int
Atts int
wildPos int
Token Token
Pattern map[int]string
Compile map[int]*regexp.Regexp
Tag map[int]string
Handler http.Handler
}
type args struct {
rw http.ResponseWriter
req *http.Request
vars map[string]string
}
tests := []struct {
name string
fields fields
args args
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
r := &Route{
Path: tt.fields.Path,
Method: tt.fields.Method,
Size: tt.fields.Size,
Atts: tt.fields.Atts,
wildPos: tt.fields.wildPos,
Token: tt.fields.Token,
Pattern: tt.fields.Pattern,
Compile: tt.fields.Compile,
Tag: tt.fields.Tag,
Handler: tt.fields.Handler,
}
r.serveMatchedRequest(tt.args.rw, tt.args.req, tt.args.vars)
})
}
}