Added Position Support to TomlTree
TomlDocument provides an optional TOML processing path where position informaiton is stored alongside a TomlTree. * Added Position struct * Revised TomlTree to contain position data * Added tomlValue to bind positions to values * Revised parser to emit position data * Revised token to use new Position struct * Added tests for new functionality * Bugfixed table array duplicate key handling * Applied gofmt to all code
This commit is contained in:
+5
-3
@@ -1,3 +1,5 @@
|
||||
// Testing support for go-toml
|
||||
|
||||
package toml
|
||||
|
||||
import (
|
||||
@@ -27,16 +29,16 @@ func TestTomlHasPath(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTomlGetPath(t *testing.T) {
|
||||
node := make(TomlTree)
|
||||
node := newTomlTree()
|
||||
//TODO: set other node data
|
||||
|
||||
for idx, item := range []struct {
|
||||
Path []string
|
||||
Expected interface{}
|
||||
Expected *TomlTree
|
||||
}{
|
||||
{ // empty path test
|
||||
[]string{},
|
||||
&node,
|
||||
node,
|
||||
},
|
||||
} {
|
||||
result := node.GetPath(item.Path)
|
||||
|
||||
Reference in New Issue
Block a user