-
Notifications
You must be signed in to change notification settings - Fork 2
/
fake_test.go
66 lines (56 loc) · 1.34 KB
/
fake_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
package fake
import (
"fmt"
"regexp"
"testing"
)
func TestFullName(t *testing.T) {
firstFullName := FullName()
secondFullName := FullName()
if firstFullName == secondFullName {
t.Errorf("Expected FullName calls to be unique. Got %s and %s", firstFullName, secondFullName)
}
}
func TestUserName(t *testing.T) {
userName := Username()
if userName == "" {
t.Errorf("Expected UserName to return a user name. Got %s", userName)
}
}
func TestCompany(t *testing.T) {
company := ""
company = Company()
if company == "" {
t.Errorf("Expected company to return a company name, Got %s", company)
}
}
func TestDomain(t *testing.T) {
domainRe := regexp.MustCompile("[a-zA-Z]+\\.[a-zA-Z]+$")
domain := ""
domain = Domain()
if domain == "" {
t.Errorf("Expected domain to return a domain, Got %s", domain)
}
if !domainRe.MatchString(domain) {
t.Errorf("Expected domain to be a domain, Got %s", domain)
}
}
func TestEmail(t *testing.T) {
email := ""
email = Email()
if email == "" {
t.Errorf("Expected email to be an email, got %s", email)
}
}
func ExampleUserF() {
fmt.Println("Full Name", FullName())
fmt.Println("First Name", FirstName())
fmt.Println("Last Name", LastName())
fmt.Println("Username", Username())
}
func ExampleCompany() {
fmt.Println("Company", Company())
}
func ExampleDomain() {
fmt.Println("Domain", Domain())
}