-
Notifications
You must be signed in to change notification settings - Fork 0
/
veil_testdata_test.go
75 lines (55 loc) · 1.02 KB
/
veil_testdata_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
package veil_test
// getInputData prepares the test dataset.
func getInputData() []interface{} {
var data []interface{}
// string
data = append(data, "hello 123")
// struct
data = append(data, struct {
Name string
Phone string
ph string
}{"Test", "123", "123"})
// map
data = append(data, map[string]int{
"phone": 123,
})
return data
}
func getStructData() []interface{} {
var data []interface{}
type User struct {
User string
Pwd string `veil:"obscure"`
group float32
}
type Data struct {
Name string
Phone string
ph int
User User
}
// input data
d := Data{
Name: "Test",
Phone: "123",
ph: 123,
User: User{
User: "User",
Pwd: "Password",
group: 1.01,
},
}
data = append(data, d)
return data
}
type StringerTester string
func (s StringerTester) String() string {
return "Using stringer for string 123"
}
func getInputDataStringer() []interface{} {
var data []interface{}
var d StringerTester = "hello"
data = append(data, d)
return data
}