Improve test coverage (#66)

This commit is contained in:
Thomas Pelletier
2016-04-22 14:26:15 +02:00
parent 288bc57940
commit 8d9c606c69
4 changed files with 96 additions and 2 deletions
+17
View File
@@ -556,6 +556,18 @@ func TestParseKeyGroupArray(t *testing.T) {
})
}
func TestParseKeyGroupArrayUnfinished(t *testing.T) {
_, err := Load("[[foo.bar]\na = 42")
if err.Error() != "(1, 10): was expecting token [[, but got unclosed key group array instead" {
t.Error("Bad error message:", err.Error())
}
_, err = Load("[[foo.[bar]\na = 42")
if err.Error() != "(1, 3): unexpected token group name cannot contain ']', was expecting a key group array" {
t.Error("Bad error message:", err.Error())
}
}
func TestParseKeyGroupArrayQueryExample(t *testing.T) {
tree, err := Load(`
[[book]]
@@ -690,6 +702,11 @@ func TestInvalidGroupArray(t *testing.T) {
if err == nil {
t.Error("Should error")
}
_, err = Load("[foo.[bar]\na = 42")
if err.Error() != "(1, 2): unexpected token group name cannot contain ']', was expecting a key group" {
t.Error("Bad error message:", err.Error())
}
}
func TestDoubleEqual(t *testing.T) {