Skip to content

Commit 6d38186

Browse files
more coverage
1 parent 031747e commit 6d38186

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

internal/utils/to_map_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import (
2121
)
2222

2323
func TestToMap(t *testing.T) {
24+
require.Nil(t, ToMap("audit", []string{}))
25+
2426
type SubStruct struct {
2527
F float64 `audit:"f"`
2628
}
@@ -31,6 +33,9 @@ func TestToMap(t *testing.T) {
3133
Sl []string `audit:"sl"`
3234
So string `audit:"so,omitempty"`
3335
Si string `audit:"si,omitempty"`
36+
37+
u string `audit:"unexported_field_will_be_ignored"`
38+
N string
3439
}
3540

3641
c := ToConvert{
@@ -39,6 +44,8 @@ func TestToMap(t *testing.T) {
3944
St: SubStruct{F: 4.2},
4045
Sl: []string{"g1", "g2"},
4146
Si: "not-omitted",
47+
u: "shrug",
48+
N: "uses the field name",
4249
}
4350

4451
result := ToMap("audit", c)
@@ -51,6 +58,7 @@ func TestToMap(t *testing.T) {
5158
},
5259
"sl": []string{"g1", "g2"},
5360
"si": "not-omitted",
61+
"N": "uses the field name",
5462
},
5563
result,
5664
)

0 commit comments

Comments
 (0)