+3
-1
@@ -345,7 +345,9 @@ func (d *decoder) handleArrayTableCollection(key ast.Iterator, v reflect.Value)
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return reflect.Value{}, err
|
return reflect.Value{}, err
|
||||||
}
|
}
|
||||||
v.Elem().Set(elem)
|
if elem.IsValid() {
|
||||||
|
v.Elem().Set(elem)
|
||||||
|
}
|
||||||
|
|
||||||
return v, nil
|
return v, nil
|
||||||
case reflect.Slice:
|
case reflect.Slice:
|
||||||
|
|||||||
@@ -2220,6 +2220,42 @@ func TestIssue666(t *testing.T) {
|
|||||||
require.Error(t, err)
|
require.Error(t, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestIssue677(t *testing.T) {
|
||||||
|
doc := `
|
||||||
|
[Build]
|
||||||
|
Name = "publication build"
|
||||||
|
|
||||||
|
[[Build.Dependencies]]
|
||||||
|
Name = "command"
|
||||||
|
Program = "hugo"
|
||||||
|
`
|
||||||
|
|
||||||
|
type _tomlJob struct {
|
||||||
|
Dependencies []map[string]interface{}
|
||||||
|
}
|
||||||
|
|
||||||
|
type tomlParser struct {
|
||||||
|
Build *_tomlJob
|
||||||
|
}
|
||||||
|
|
||||||
|
p := tomlParser{}
|
||||||
|
|
||||||
|
err := toml.Unmarshal([]byte(doc), &p)
|
||||||
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
expected := tomlParser{
|
||||||
|
Build: &_tomlJob{
|
||||||
|
Dependencies: []map[string]interface{}{
|
||||||
|
{
|
||||||
|
"Name": "command",
|
||||||
|
"Program": "hugo",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
require.Equal(t, expected, p)
|
||||||
|
}
|
||||||
|
|
||||||
//nolint:funlen
|
//nolint:funlen
|
||||||
func TestUnmarshalDecodeErrors(t *testing.T) {
|
func TestUnmarshalDecodeErrors(t *testing.T) {
|
||||||
examples := []struct {
|
examples := []struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user