encode: fix embedded interfaces (#753)

Resolve marshaling regression when handling an embedded interface in a
struct.

Fixes #752
This commit is contained in:
Thomas Pelletier
2022-04-08 09:25:54 -04:00
committed by GitHub
parent f5cc8c49eb
commit 2377ac4bc0
2 changed files with 19 additions and 1 deletions
+16
View File
@@ -947,6 +947,22 @@ func TestIssue678(t *testing.T) {
require.Equal(t, cfg, cfg2)
}
func TestIssue752(t *testing.T) {
type Fooer interface {
Foo() string
}
type Container struct {
Fooer
}
c := Container{}
out, err := toml.Marshal(c)
require.NoError(t, err)
require.Equal(t, "", string(out))
}
func TestMarshalNestedAnonymousStructs(t *testing.T) {
type Embedded struct {
Value string `toml:"value" json:"value"`