Add some edit sequences to corpus tests
This commit is contained in:
parent
d032114d7a
commit
90862dd18f
3 changed files with 27 additions and 9 deletions
|
|
@ -35,7 +35,7 @@ describe("Languages", [&]() {
|
|||
describe(("The " + pair.first + " parser").c_str(), [&]() {
|
||||
before_each([&]() {
|
||||
ts_document_set_language(doc, pair.second);
|
||||
// ts_document_set_debugger(doc, log_debugger_make());
|
||||
// ts_document_set_debugger(doc, log_debugger_make(true));
|
||||
});
|
||||
|
||||
for (auto &entry : test_entries_for_language(pair.first)) {
|
||||
|
|
@ -48,7 +48,7 @@ describe("Languages", [&]() {
|
|||
};
|
||||
|
||||
auto it_handles_edit_sequence = [&](string name, std::function<void()> edit_sequence){
|
||||
it(("handles " + entry.description + ": " + name).c_str(), [&]() {
|
||||
it(("parses " + entry.description + ": " + name).c_str(), [&]() {
|
||||
input = new SpyInput(entry.input, 3);
|
||||
ts_document_set_input(doc, input->input());
|
||||
edit_sequence();
|
||||
|
|
@ -61,7 +61,15 @@ describe("Languages", [&]() {
|
|||
ts_document_parse(doc);
|
||||
});
|
||||
|
||||
it_handles_edit_sequence("one insertion, undo", [&]() {
|
||||
it_handles_edit_sequence("repairing an inserted error", [&]() {
|
||||
ts_document_edit(doc, input->replace(entry.input.size() / 2, 0, "%^&*"));
|
||||
ts_document_parse(doc);
|
||||
|
||||
ts_document_edit(doc, input->undo());
|
||||
ts_document_parse(doc);
|
||||
});
|
||||
|
||||
it_handles_edit_sequence("creating and repairing an inserted error", [&]() {
|
||||
ts_document_parse(doc);
|
||||
|
||||
ts_document_edit(doc, input->replace(entry.input.size() / 2, 0, "%^&*"));
|
||||
|
|
@ -71,7 +79,7 @@ describe("Languages", [&]() {
|
|||
ts_document_parse(doc);
|
||||
});
|
||||
|
||||
it_handles_edit_sequence("one deletion, undo", [&]() {
|
||||
it_handles_edit_sequence("repairing an errant deletion", [&]() {
|
||||
ts_document_parse(doc);
|
||||
|
||||
ts_document_edit(doc, input->replace(entry.input.size() / 2, 5, ""));
|
||||
|
|
@ -80,6 +88,14 @@ describe("Languages", [&]() {
|
|||
ts_document_edit(doc, input->undo());
|
||||
ts_document_parse(doc);
|
||||
});
|
||||
|
||||
it_handles_edit_sequence("creating and repairing an errant deletion", [&]() {
|
||||
ts_document_edit(doc, input->replace(entry.input.size() / 2, 5, ""));
|
||||
ts_document_parse(doc);
|
||||
|
||||
ts_document_edit(doc, input->undo());
|
||||
ts_document_parse(doc);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue