forked from icrowley/fake
-
Notifications
You must be signed in to change notification settings - Fork 2
/
simple_test.go
103 lines (90 loc) · 2.5 KB
/
simple_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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
package fake
import "testing"
var simpleFuncs = map[string]func() string{
// Addresses
"Continent": Continent,
"Country": Country,
"City": City,
"Phone": Phone,
"State": State,
"Street": Street,
"StreetAddress": StreetAddress,
"Zip": Zip,
// Currencies
"Currency": Currency,
"CurrencyCode": CurrencyCode,
// Dates
"WeekDay": WeekDay,
"WeekDayShort": WeekDayShort,
"Month": Month,
"MonthShort": MonthShort,
// General
"Color": Color,
// Internet
"UserName": UserName,
"TopLevelDomain": TopLevelDomain,
"DomainName": DomainName,
"EmailAddress": EmailAddress,
"EmailSubject": EmailSubject,
"EmailBody": EmailBody,
"DomainZone": DomainZone,
// Jobs
"Company": Company,
"JobTitle": JobTitle,
"Industry": Industry,
// Lorem Ipsum
"Character": Character,
"Characters": Characters,
"Word": Word,
"Words": Words,
"Title": Title,
"Sentence": Sentence,
"Sentences": Sentences,
"Paragraph": Paragraph,
"Paragraphs": Paragraphs,
// Names
"MaleFirstName": MaleFirstName,
"FemaleFirstName": FemaleFirstName,
"FirstName": FirstName,
"MaleLastName": MaleLastName,
"FemaleLastName": FemaleLastName,
"LastName": LastName,
"MalePatronymic": MalePatronymic,
"FemalePatronymic": FemalePatronymic,
"Patronymic": Patronymic,
"MaleFullNameWithPrefix": MaleFullNameWithPrefix,
"FemaleFullNameWithPrefix": FemaleFullNameWithPrefix,
"FullNameWithPrefix": FullNameWithPrefix,
"MaleFullNameWithSuffix": MaleFullNameWithSuffix,
"FemaleFullNameWithSuffix": FemaleFullNameWithSuffix,
"FullNameWithSuffix": FullNameWithSuffix,
"MaleFullName": MaleFullName,
"FemaleFullName": FemaleFullName,
"FullName": FullName,
// Personal
"Gender": Gender,
"GenderAbbrev": GenderAbbrev,
"Language": Language,
// Products
"Brand": Brand,
"ProductName": ProductName,
"Product": Product,
"Model": Model,
}
func TestSimpleFuncs(t *testing.T) {
for _, lang := range GetLangs() {
err := SetLang(lang)
if err != nil {
t.Errorf("Could not set language %s", lang)
}
for name, funct := range simpleFuncs {
name, funct := name, funct // capture range variable
t.Run(name, func(t *testing.T) {
t.Parallel()
if a := funct(); a == "" {
t.Errorf("%s failed with lang %s", name, lang)
}
})
}
}
}