Add couple tests

This commit is contained in:
Thomas Pelletier
2016-04-18 16:46:44 +02:00
parent 4d8fb95ffe
commit 9d93af61de
+12
View File
@@ -15,6 +15,10 @@ func TestTomlHas(t *testing.T) {
if !tree.Has("test.key") {
t.Errorf("Has - expected test.key to exists")
}
if tree.Has("") {
t.Errorf("Should return false if the key is not provided")
}
}
func TestTomlHasPath(t *testing.T) {
@@ -72,3 +76,11 @@ func TestTomlQuery(t *testing.T) {
t.Errorf("Expected 'b' with a value 2: %v", tt.Get("b"))
}
}
func TestTomlFromMap(t *testing.T) {
simpleMap := map[string]interface{}{"hello": 42}
tree := TreeFromMap(simpleMap)
if tree.Get("hello") != 42 {
t.Fatal("hello should be 42, not", tree.Get("hello"))
}
}