Fix ToMap for tables in mixed-type arrays (#453)

This commit is contained in:
Micah Stetson
2020-11-14 18:15:35 -08:00
committed by GitHub
parent 5b4e7e5dcc
commit 1bd9461acb
2 changed files with 35 additions and 1 deletions
+15
View File
@@ -295,6 +295,21 @@ func TestTreeWriteToMapWithArrayOfInlineTables(t *testing.T) {
testMaps(t, treeMap, expected)
}
func TestTreeWriteToMapWithTableInMixedArray(t *testing.T) {
tree, _ := Load(`a = ["foo", {bar = "baz"}]`)
expected := map[string]interface{}{
"a": []interface{}{
"foo",
map[string]interface{}{
"bar": "baz",
},
},
}
treeMap := tree.ToMap()
testMaps(t, treeMap, expected)
}
func TestTreeWriteToFloat(t *testing.T) {
tree, err := Load(`a = 3.0`)
if err != nil {