File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ import (
21
21
)
22
22
23
23
func TestToMap (t * testing.T ) {
24
+ require .Nil (t , ToMap ("audit" , []string {}))
25
+
24
26
type SubStruct struct {
25
27
F float64 `audit:"f"`
26
28
}
@@ -31,6 +33,9 @@ func TestToMap(t *testing.T) {
31
33
Sl []string `audit:"sl"`
32
34
So string `audit:"so,omitempty"`
33
35
Si string `audit:"si,omitempty"`
36
+
37
+ u string `audit:"unexported_field_will_be_ignored"`
38
+ N string
34
39
}
35
40
36
41
c := ToConvert {
@@ -39,6 +44,8 @@ func TestToMap(t *testing.T) {
39
44
St : SubStruct {F : 4.2 },
40
45
Sl : []string {"g1" , "g2" },
41
46
Si : "not-omitted" ,
47
+ u : "shrug" ,
48
+ N : "uses the field name" ,
42
49
}
43
50
44
51
result := ToMap ("audit" , c )
@@ -51,6 +58,7 @@ func TestToMap(t *testing.T) {
51
58
},
52
59
"sl" : []string {"g1" , "g2" },
53
60
"si" : "not-omitted" ,
61
+ "N" : "uses the field name" ,
54
62
},
55
63
result ,
56
64
)
You can’t perform that action at this time.
0 commit comments