[ruby/prism] Be explicit in tests which files parser
can't parse
It also updates to latest `parser`, which allows numbered parameters in pattern matching pin, passing `patterns.txt` and `case.txt` https://github.com/ruby/prism/commit/bdcc8b3dc5
This commit is contained in:
parent
334c261cc9
commit
d543fda433
@ -56,6 +56,16 @@ Parser::AST::Node.prepend(
|
||||
|
||||
module Prism
|
||||
class ParserTest < TestCase
|
||||
# These files contain code with valid syntax that can't be parsed.
|
||||
skip_syntax_error = [
|
||||
# alias/undef with %s(abc) symbol literal
|
||||
"alias.txt",
|
||||
"seattlerb/bug_215.txt",
|
||||
|
||||
# 1.. && 2
|
||||
"ranges.txt",
|
||||
]
|
||||
|
||||
# These files contain code that is being parsed incorrectly by the parser
|
||||
# gem, and therefore we don't want to compare against our translation.
|
||||
skip_incorrect = [
|
||||
@ -133,7 +143,7 @@ module Prism
|
||||
"whitequark/space_args_block.txt"
|
||||
]
|
||||
|
||||
Fixture.each do |fixture|
|
||||
Fixture.each(except: skip_syntax_error) do |fixture|
|
||||
define_method(fixture.test_name) do
|
||||
assert_equal_parses(
|
||||
fixture,
|
||||
@ -190,11 +200,7 @@ module Prism
|
||||
parser.diagnostics.all_errors_are_fatal = true
|
||||
|
||||
expected_ast, expected_comments, expected_tokens =
|
||||
begin
|
||||
ignore_warnings { parser.tokenize(buffer) }
|
||||
rescue ArgumentError, Parser::SyntaxError
|
||||
return
|
||||
end
|
||||
ignore_warnings { parser.tokenize(buffer) }
|
||||
|
||||
actual_ast, actual_comments, actual_tokens =
|
||||
ignore_warnings { Prism::Translation::Parser33.new.tokenize(buffer) }
|
||||
|
Loading…
x
Reference in New Issue
Block a user