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:
+4
-3
@@ -662,10 +662,11 @@ func TestTomlValueStringRepresentation(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestToStringMapStringString(t *testing.T) {
|
||||
in := map[string]interface{}{"m": TreeFromMap(map[string]interface{}{
|
||||
"v": &tomlValue{"abc", Position{0, 0}}})}
|
||||
tree, err := TreeFromMap(map[string]interface{}{"m": map[string]interface{}{"v": "abc"}})
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error: %s", err)
|
||||
}
|
||||
want := "\n[m]\n v = \"abc\"\n"
|
||||
tree := TreeFromMap(in)
|
||||
got := tree.String()
|
||||
|
||||
if got != want {
|
||||
|
||||
Reference in New Issue
Block a user