unmarshal: don't panic when storing table in slice (#641)
New error message: ``` toml: cannot store a table in a slice 1| [things] | ~~~~~~ cannot store a table in a slice 2| foo = "bar" ``` Fixes #623
This commit is contained in:
@@ -1810,6 +1810,18 @@ func TestIssue602(t *testing.T) {
|
||||
require.Equal(t, expected, v)
|
||||
}
|
||||
|
||||
func TestIssue623(t *testing.T) {
|
||||
definition := struct {
|
||||
Things []string
|
||||
}{}
|
||||
|
||||
values := `[things]
|
||||
foo = "bar"`
|
||||
|
||||
err := toml.Unmarshal([]byte(values), &definition)
|
||||
require.Error(t, err)
|
||||
}
|
||||
|
||||
//nolint:funlen
|
||||
func TestUnmarshalDecodeErrors(t *testing.T) {
|
||||
examples := []struct {
|
||||
|
||||
Reference in New Issue
Block a user