Don't hang when reading an invalid rvalue (#77)

Fixes #76
This commit is contained in:
Thomas Pelletier
2016-06-30 16:21:25 +02:00
committed by GitHub
parent b39f6ef1f9
commit 64ff1ea4d5
3 changed files with 27 additions and 0 deletions
+12
View File
@@ -299,6 +299,18 @@ func TestArrayNestedStrings(t *testing.T) {
})
}
func TestParseUnknownRvalue(t *testing.T) {
_, err := Load("a = !bssss")
if err == nil {
t.Error("Expecting a parse error")
}
_, err = Load("a = /b")
if err == nil {
t.Error("Expecting a parse error")
}
}
func TestMissingValue(t *testing.T) {
_, err := Load("a = ")
if err.Error() != "(1, 5): expecting a value" {