diff options
| author | Kevin Newton <kddnewton@gmail.com> | 2023-09-27 12:58:44 -0400 |
|---|---|---|
| committer | Kevin Newton <kddnewton@gmail.com> | 2023-09-27 13:57:38 -0400 |
| commit | 224e76ada7b6b66ee65b371f9bfb802518d07552 (patch) | |
| tree | 1a9620896999248b66e4670ce0ad80270053cede /test | |
| parent | 3d0a46796b780417096b65de5edb590d3b1537f1 (diff) | |
Include recently added parse_test code in rename
Diffstat (limited to 'test')
| -rw-r--r-- | test/prism/parse_test.rb | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/test/prism/parse_test.rb b/test/prism/parse_test.rb index 8eb87befa0..65128bf5a7 100644 --- a/test/prism/parse_test.rb +++ b/test/prism/parse_test.rb @@ -85,9 +85,20 @@ module Prism # and explicitly set the external encoding to UTF-8 to override the binmode default. source = File.read(filepath, binmode: true, external_encoding: Encoding::UTF_8) - # Make sure that it can be correctly parsed by Ripper. If it can't, then we have a fixture - # that is invalid Ruby. - refute_nil(Ripper.sexp_raw(source), "Ripper failed to parse") if ripper_should_parse + if ripper_should_parse + src = source + + case relative + when /break|next|redo|if|unless|rescue|control|keywords|retry/ + # Uncaught syntax errors: Invalid break, Invalid next + src = "->do\nrescue\n#{src}\nend" + ripper_should_match = false + end + + # Make sure that it can be correctly parsed by Ripper. If it can't, then we have a fixture + # that is invalid Ruby. + refute_nil(Ripper.sexp_raw(src), "Ripper failed to parse") + end # Next, assert that there were no errors during parsing. result = Prism.parse(source, relative) |
