Fix bug in parser error handling

This commit is contained in:
Max Brunsfeld 2014-02-25 18:32:17 -08:00
parent 4541332c2b
commit df223d566e
3 changed files with 24 additions and 14 deletions

View file

@ -48,6 +48,16 @@ describe("json", []() {
ts_document_set_text(doc, "[1, 2, 3]");
AssertThat(string(ts_document_string(doc)), Equals("(value (array (value (number)) (value (number)) (value (number))))"));
});
describe("errors", [&]() {
it("reports errors in the top-level node", [&]() {
ts_document_set_text(doc, "[");
AssertThat(string(ts_document_string(doc)), Equals("(ERROR)"));
ts_document_set_text(doc, "{ \"key1\": 1, ");
AssertThat(string(ts_document_string(doc)), Equals("(ERROR)"));
});
});
});
END_TEST