Reset lexer correctly when old input was blank
This commit is contained in:
parent
e32fe07432
commit
8a146a9bef
4 changed files with 28 additions and 6 deletions
|
|
@ -66,6 +66,20 @@ describe("Document", [&]() {
|
|||
"(object (string) (array (null) (number)))"));
|
||||
AssertThat(spy_input->strings_read, Equals(vector<string>({" [null, 2", ""})));
|
||||
});
|
||||
|
||||
it("reads from the new input correctly when the old input was blank", [&]() {
|
||||
ts_document_set_input_string(doc, "");
|
||||
ts_document_parse(doc);
|
||||
TSNode new_root = ts_document_root_node(doc);
|
||||
AssertThat(ts_node_string(new_root, doc), Equals(
|
||||
"(ERROR (UNEXPECTED <EOF>))"));
|
||||
|
||||
ts_document_set_input_string(doc, "1");
|
||||
ts_document_parse(doc);
|
||||
new_root = ts_document_root_node(doc);
|
||||
AssertThat(ts_node_string(new_root, doc), Equals(
|
||||
"(number)"));
|
||||
});
|
||||
});
|
||||
|
||||
describe("set_language(language)", [&]() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue