Skip to content

Commit

Permalink
Add test for interface containing slice
Browse files Browse the repository at this point in the history
  • Loading branch information
pelletier committed Feb 27, 2024
1 parent 78ad639 commit 51b667a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions unmarshaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2847,6 +2847,27 @@ func TestIssue931(t *testing.T) {
}

func TestIssue931Interface(t *testing.T) {
type items struct {
Slice interface{}
}

type item = map[string]interface{}

its := items{[]interface{}{item{"Name": "a"}, item{"Name": "b"}}}

b := []byte(`
[[Slice]]
Name = 'c'
[[Slice]]
Name = 'd'
`)

toml.Unmarshal(b, &its)
require.Equal(t, items{[]interface{}{item{"Name": "c"}, item{"Name": "d"}}}, its)
}

func TestIssue931SliceInterface(t *testing.T) {
type items struct {
Slice []interface{}
}
Expand Down

0 comments on commit 51b667a

Please sign in to comment.