-
Notifications
You must be signed in to change notification settings - Fork 1
/
router_test.go
63 lines (61 loc) · 1.17 KB
/
router_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
package cango
import (
"reflect"
"testing"
)
func Test_combinePaths(t *testing.T) {
type args struct {
tagPaths string
strUrls []string
prefix string
}
tests := []struct {
name string
args args
wantPaths []string
}{
{
name: "empty_tag",
args: args{
tagPaths: "",
strUrls: []string{"str"},
prefix: "/prefix",
},
wantPaths: []string{"/prefix/str"},
},
{
name: "empty_str",
args: args{
tagPaths: "tag",
strUrls: []string{},
prefix: "/prefix",
},
wantPaths: []string{"/prefix/tag"},
},
{
name: "empty",
args: args{
tagPaths: "",
strUrls: nil,
prefix: "/prefix",
},
wantPaths: []string{"/prefix"},
},
{
name: "full",
args: args{
tagPaths: "tag1",
strUrls: []string{"str1", "str2"},
prefix: "/prefix",
},
wantPaths: []string{"/prefix/str1/tag1", "/prefix/str2/tag1"},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if gotPaths := combinePaths(tt.args.prefix, tt.args.strUrls, tt.args.tagPaths); !reflect.DeepEqual(gotPaths, tt.wantPaths) {
t.Errorf("appendPaths() = %v, want %v", gotPaths, tt.wantPaths)
}
})
}
}