Add basic support for error recovery

This commit is contained in:
Max Brunsfeld 2014-02-26 19:03:43 -08:00
parent df05c75525
commit 63718d5bad
21 changed files with 369 additions and 100 deletions

View file

@ -53,9 +53,11 @@ describe("json", []() {
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)"));
});
it("reports errors inside of nested objects", [&]() {
ts_document_set_text(doc, "{ \"key1\": 1, 5 }");
AssertThat(string(ts_document_string(doc)), Equals("(value (object (string) (value (number)) (ERROR)))"));
});
});
});