forked from icrowley/fake
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgeneral_test.go
More file actions
42 lines (34 loc) · 728 Bytes
/
Copy pathgeneral_test.go
File metadata and controls
42 lines (34 loc) · 728 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
package fake
import "testing"
var generalFuncs = map[string]func() string{
"SimplePassword": SimplePassword,
"HexColor": HexColor,
"HexColorShort": HexColorShort,
"Digits": Digits,
}
func TestGeneral(t *testing.T) {
t.Parallel()
for name, funct := range generalFuncs {
name, funct := name, funct // capture range variable
t.Run(name, func(t *testing.T) {
t.Parallel()
if a := funct(); a == "" {
t.Errorf("%s failed", name)
}
})
}
}
func TestDigitsN(t *testing.T) {
t.Parallel()
v := DigitsN(2)
if v == "" {
t.Error("DigitsN failed")
}
}
func TestPassword(t *testing.T) {
t.Parallel()
v := Password(4, 10, true, true, true)
if v == "" {
t.Error("Password failed")
}
}