Skip to content

Commit

Permalink
Add tests for map conversion with array table
Browse files Browse the repository at this point in the history
  • Loading branch information
pelletier committed Aug 15, 2016
1 parent 9e8976b commit df0392f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tomltree_conversions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,25 @@ func TestTomlTreeConversionToMapExampleFile(t *testing.T) {
}
testMaps(t, tree.ToMap(), expected)
}

func TestTomlTreeConversionToMapWithTablesInMultipleChunks(t *testing.T) {
tree, _ := Load(`
[[menu.main]]
a = "menu 1"
b = "menu 2"
[[menu.main]]
c = "menu 3"
d = "menu 4"`)
expected := map[string]interface{}{
"menu": map[string]interface{}{
"main": []interface{}{
map[string]interface{}{"a": "menu 1", "b": "menu 2", },
map[string]interface{}{"c": "menu 3", "d": "menu 4", },
},
},
}
treeMap := tree.ToMap()


testMaps(t, treeMap, expected)
}

0 comments on commit df0392f

Please sign in to comment.