-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstringfield_test.go
55 lines (53 loc) · 984 Bytes
/
stringfield_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
package tagvalidate
import "testing"
func Test_regx_check(t *testing.T) {
type args struct {
v string
regx string
}
tests := []struct {
name string
args args
want bool
}{
// TODO: Add test cases.
}
for name, ta := range type_map {
if ta.Regx == "" {
continue
}
for _, str := range []string{
"https://www.bbc.com",
"https://www.bbc.com/",
"/www.bbc.com/aaa",
"www.ddd.cn",
"c4b1866a-a021-41e1-8deb-cc9b6e9c1f36",
"c4b1866acc9b6e9c1f36",
"c4b1866a",
"11222",
"112..22",
"11.2.22",
".2.22",
".2",
"1.2",
"-12",
"-1.2",
"汉纸的",
"YQ==",
} {
tests = append(tests, struct {
name string
args args
want bool
}{name + "/" + str, args{str, ta.Regx}, false})
}
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := regx_check(tt.args.v, tt.args.regx); got != tt.want {
t.Errorf("regx_check() = %v, want %v", got, tt.want)
}
})
}
}