Add ability to edit multiple times between parses
This commit is contained in:
parent
6254f45c1b
commit
f37f73f92f
13 changed files with 135 additions and 119 deletions
|
|
@ -39,6 +39,7 @@ describe("Languages", [&]() {
|
|||
|
||||
it(("parses " + entry.description).c_str(), [&]() {
|
||||
ts_document_set_input_string(doc, entry.input.c_str());
|
||||
ts_document_parse(doc);
|
||||
expect_the_correct_tree();
|
||||
});
|
||||
|
||||
|
|
@ -50,15 +51,18 @@ describe("Languages", [&]() {
|
|||
it(("handles random insertions in " + entry.description).c_str(), [&]() {
|
||||
SpyInput reader(entry.input, 3);
|
||||
ts_document_set_input(doc, reader.input());
|
||||
ts_document_parse(doc);
|
||||
|
||||
string garbage("%^&*");
|
||||
size_t position = entry.input.size() / 2;
|
||||
|
||||
reader.insert(position, garbage);
|
||||
ts_document_edit(doc, { position, garbage.size(), 0 });
|
||||
ts_document_parse(doc);
|
||||
|
||||
reader.erase(position, garbage.size());
|
||||
ts_document_edit(doc, { position, 0, garbage.size() });
|
||||
ts_document_parse(doc);
|
||||
|
||||
expect_the_correct_tree();
|
||||
});
|
||||
|
|
@ -66,15 +70,18 @@ describe("Languages", [&]() {
|
|||
it(("handles random deletions in " + entry.description).c_str(), [&]() {
|
||||
SpyInput reader(entry.input, 3);
|
||||
ts_document_set_input(doc, reader.input());
|
||||
ts_document_parse(doc);
|
||||
|
||||
size_t position = entry.input.size() / 2;
|
||||
string removed = entry.input.substr(position);
|
||||
|
||||
reader.erase(position, removed.size());
|
||||
ts_document_edit(doc, { position, 0, removed.size() });
|
||||
ts_document_parse(doc);
|
||||
|
||||
reader.insert(position, removed);
|
||||
ts_document_edit(doc, { position, removed.size(), 0 });
|
||||
ts_document_parse(doc);
|
||||
|
||||
expect_the_correct_tree();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue