@@ 6,9 6,10 @@ import (
"io"
"strings"
)
-
+// Tree represents a ini file structure.
type Tree map[string]map[string]string
+// Parse parses the input stream and returns the parsed Tree.
func Parse(r io.Reader) (Tree, error) {
t := make(Tree)
var section string
@@ 29,4 30,4 @@ func Parse(r io.Reader) (Tree, error) {
}
}
return t, scanner.Err()
-}
No newline at end of file
+}
@@ 18,13 18,6 @@ var tests = []struct {
{"=", nil, true},
{"; =", make(Tree), true},
{"[section]", func() Tree { t := make(Tree); t["section"] = make(map[string]string); return t }(), false},
- {"[person]\nname=John", func() Tree {
- t := make(Tree)
- p := make(map[string]string)
- p["name"] = "John"
- t["person"] = p
- return t
- }(), false},
{`[dmr]
first name=Dennis
last name=Ritchie