Rework tree from map (#139)

* Make TreeFromMap reflect to construct tree
* Fix wording of invalid value type in writeTo

Fixes #138, #139, #134 

⚠️ TreeFromMap signature changed to `TreeFromMap(map[string]interface{}) (*TomlTree, error)`
This commit is contained in:
Thomas Pelletier
2017-03-14 13:16:40 -07:00
committed by GitHub
parent 3b00596b2e
commit fee7787d3f
7 changed files with 240 additions and 13 deletions
+1 -1
View File
@@ -146,7 +146,7 @@ func TestTomlTreeWriteToMapSimple(t *testing.T) {
func TestTomlTreeWriteToInvalidTreeSimpleValue(t *testing.T) {
tree := TomlTree{values: map[string]interface{}{"foo": int8(1)}}
_, err := tree.ToTomlString()
assertErrorString(t, "invalid key type at foo: int8", err)
assertErrorString(t, "invalid value type at foo: int8", err)
}
func TestTomlTreeWriteToInvalidTreeTomlValue(t *testing.T) {