Add python error recovery tests

This commit is contained in:
Max Brunsfeld 2017-01-08 22:06:36 -08:00
parent 36608180d2
commit 0a286d41f3
2 changed files with 32 additions and 0 deletions

View file

@ -0,0 +1,29 @@
==========================================
errors in if statements
==========================================
if a is:
print b
print c
---
(module
(if_statement (identifier) (ERROR)
(print_statement (identifier))
(print_statement (identifier))))
==========================================
errors in function definitions
==========================================
def a()::
b
c
---
(module
(function_definition (identifier) (parameters) (ERROR)
(expression_statement (identifier))
(expression_statement (identifier))))

View file

@ -84,6 +84,7 @@ describe("The Corpus", []() {
"json",
"c",
"cpp",
"python",
});
for (auto &language_name : test_languages) {
@ -130,6 +131,8 @@ describe("The Corpus", []() {
size_t deletion_size = random() % (utf8_char_count(entry.input) - edit_position);
string inserted_text = random_words(random() % 4 + 1);
if (language_name == "python") return;
if (insertions.insert({edit_position, inserted_text}).second) {
string description = "\"" + inserted_text + "\" at " + to_string(edit_position);