Add tests for errors (fixes #5)

This commit is contained in:
Thomas Pelletier
2013-03-22 15:23:53 +01:00
parent 183bbe2aa9
commit 2bd1eb4f21
3 changed files with 18 additions and 3 deletions
+14
View File
@@ -101,3 +101,17 @@ func TestArrayNested(t *testing.T) {
"a": [][]int64{[]int64{int64(42), int64(21)}, []int64{int64(10)}},
})
}
func TestMissingValue(t *testing.T) {
_, err := Load("a = ")
if (err.Error() != "expecting a value") {
t.Error("Bad error message:", err.Error());
}
}
func TestUnterminatedArray(t *testing.T) {
_, err := Load("a = [1,")
if (err.Error() != "unterminated array") {
t.Error("Bad error message:", err.Error());
}
}