-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathregexp_test.go
53 lines (46 loc) · 1.07 KB
/
regexp_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
package str
import (
"testing"
)
func TestIsMail1(t *testing.T) {
got := IsMail("ulric.qin-_abc@a.com")
expect := true
if got != expect {
t.Errorf("IsMail1:\n Expect => %v\n Got => %v\n", expect, got)
}
}
func TestIsMail2(t *testing.T) {
got := IsMail("i@a.com")
expect := true
if got != expect {
t.Errorf("IsMail2:\n Expect => %v\n Got => %v\n", expect, got)
}
}
func TestIsMail3(t *testing.T) {
got := IsMail("ia.com")
expect := false
if got != expect {
t.Errorf("IsMail3:\n Expect => %v\n Got => %v\n", expect, got)
}
}
func TestIsPhone1(t *testing.T) {
got := IsPhone("18655555555")
expect := true
if got != expect {
t.Errorf("TestIsPhone1:\n Expect => %v\n Got => %v\n", expect, got)
}
}
func TestIsPhone2(t *testing.T) {
got := IsPhone("+8618688885555")
expect := true
if got != expect {
t.Errorf("TestIsPhone2:\n Expect => %v\n Got => %v\n", expect, got)
}
}
func TestIsPhone3(t *testing.T) {
got := IsPhone("1861218552")
expect := false
if got != expect {
t.Errorf("TestIsPhone3:\n Expect => %v\n Got => %v\n", expect, got)
}
}