-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain_test.go
More file actions
58 lines (56 loc) · 975 Bytes
/
main_test.go
File metadata and controls
58 lines (56 loc) · 975 Bytes
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
package yurls
import (
"reflect"
"testing"
)
func TestParse(t *testing.T) {
type args struct {
content string
}
tests := []struct {
name string
args args
want []string
}{
{
name: "Test 1",
args: args{
content: "https://www.google.com",
},
want: []string{
"https://www.google.com",
},
},
{
name: "Test 2",
args: args{
content: "https://www.google.com https://www.google.com/123",
},
want: []string{
"https://www.google.com",
"https://www.google.com/123",
},
},
{
name: "Test 3",
args: args{
content: "你好test.com",
},
want: []string{"test.com"},
},
{
name: "Test 4",
args: args{
content: "再见test.com test.c 1.2",
},
want: []string{"test.com"},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := Parse(tt.args.content); !reflect.DeepEqual(got, tt.want) {
t.Errorf("Parse() = %v, want %v", got, tt.want)
}
})
}
}