extended Has function to work with paths

This commit is contained in:
Philipp Brüll
2014-07-09 16:34:41 +02:00
parent c1ad095e9b
commit e9ae961088
2 changed files with 50 additions and 7 deletions
+22
View File
@@ -4,6 +4,28 @@ import (
"testing"
)
func TestTomlHas(t *testing.T) {
tree, _ := Load(`
[test]
key = "value"
`)
if !tree.Has("test.key") {
t.Errorf("Has - expected test.key to exists")
}
}
func TestTomlHasPath(t *testing.T) {
tree, _ := Load(`
[test]
key = "value"
`)
if !tree.HasPath([]string{"test", "key"}) {
t.Errorf("HasPath - expected test.key to exists")
}
}
func TestTomlGetPath(t *testing.T) {
node := make(TomlTree)
//TODO: set other node data