[ruby/prism] Only run ripper tests on 3.3+

https://github.com/ruby/prism/commit/f8b973e8cd
This commit is contained in:
Kevin Newton 2024-03-06 10:43:57 -05:00 committed by git
parent bafe897351
commit 1966b5c8c6
3 changed files with 7 additions and 11 deletions

View File

@ -903,21 +903,13 @@ module Prism
if node.locals.any? if node.locals.any?
visit_all(node.locals) visit_all(node.locals)
else else
visit_block_parameters_node_empty_locals false
end end
bounds(node.location) bounds(node.location)
on_block_var(parameters, locals) on_block_var(parameters, locals)
end end
if RUBY_ENGINE == "jruby"
# For JRuby, empty locals in an on_block_var is nil.
private def visit_block_parameters_node_empty_locals; nil; end
else
# For everyone else, empty locals in an on_block_var is false.
private def visit_block_parameters_node_empty_locals; false; end
end
# break # break
# ^^^^^ # ^^^^^
# #

View File

@ -44,7 +44,6 @@ module Prism
module_eval(<<-End, __FILE__, __LINE__ + 1) module_eval(<<-End, __FILE__, __LINE__ + 1)
def on_#{event}(*args) def on_#{event}(*args)
args.unshift :#{event} args.unshift :#{event}
args
end end
End End
end end

View File

@ -1,5 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
return if RUBY_VERSION < "3.3"
require_relative "test_helper" require_relative "test_helper"
module Prism module Prism
@ -52,10 +54,13 @@ module Prism
relatives.each do |relative| relatives.each do |relative|
# Skip the tests that Ripper is reporting the wrong results for. # Skip the tests that Ripper is reporting the wrong results for.
next if incorrect.include?(relative) next if incorrect.include?(relative)
# Skip the tests we haven't implemented yet.
next if omitted.include?(relative)
filepath = File.join(__dir__, "fixtures", relative) filepath = File.join(__dir__, "fixtures", relative)
define_method "test_ripper_#{relative}" do define_method "test_ripper_#{relative}" do
omit("Not yet implemented") if omitted.include?(relative)
source = File.read(filepath, binmode: true, external_encoding: Encoding::UTF_8) source = File.read(filepath, binmode: true, external_encoding: Encoding::UTF_8)
case relative case relative