decoder: handle private anonymous structs

Ref #508
This commit is contained in:
Thomas Pelletier
2021-04-15 12:49:24 -04:00
parent 080baa8574
commit b86b890b8d
2 changed files with 19 additions and 4 deletions
+16
View File
@@ -931,3 +931,19 @@ func TestIssue287(t *testing.T) {
}
require.Equal(t, expected, v)
}
func TestIssue508(t *testing.T) {
type head struct {
Title string `toml:"title"`
}
type text struct {
head
}
var b = []byte(`title = "This is a title"`)
t1 := text{}
err := toml.Unmarshal(b, &t1)
require.NoError(t, err)
require.Equal(t, "This is a title", t1.head.Title)
}