Reflect actual slice type in TreeFromMap (#145)

* Reflect actual slice type in TreeFromMap
* Fix writeTo for slices tomlValues

Fixes #143
This commit is contained in:
Thomas Pelletier
2017-03-23 11:20:46 +01:00
committed by GitHub
parent 25e50242f6
commit f6e7596e8d
4 changed files with 36 additions and 20 deletions
-13
View File
@@ -119,19 +119,6 @@ func testMaps(t *testing.T, actual, expected map[string]interface{}) {
}
}
func TestToTomlStringTypeConversionError(t *testing.T) {
tree := TomlTree{
values: map[string]interface{}{
"thing": &tomlValue{[]string{"unsupported"}, Position{}},
},
}
_, err := tree.ToTomlString()
expected := errors.New("unsupported value type []string: [unsupported]")
if err.Error() != expected.Error() {
t.Errorf("expecting error %s, but got %s instead", expected, err)
}
}
func TestTomlTreeWriteToMapSimple(t *testing.T) {
tree, _ := Load("a = 42\nb = 17")