diff options
| author | Earlopain <14981592+Earlopain@users.noreply.github.com> | 2026-01-21 13:19:42 +0100 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2026-01-21 13:21:37 +0000 |
| commit | 8aedb89681c42a8d6169ff1950135f841cd578f1 (patch) | |
| tree | d6611b6ce57101c53c572cfd9d0fdc23994193b2 /test/prism/ruby | |
| parent | 913ffcd1ddb854d2fdbf73a6ddf1930b8a472322 (diff) | |
[ruby/prism] Also handle `BasicObject` as a return value
We should touch these as little as possible and just pass them along
https://github.com/ruby/prism/commit/52c4fa785e
Diffstat (limited to 'test/prism/ruby')
| -rw-r--r-- | test/prism/ruby/ripper_test.rb | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/test/prism/ruby/ripper_test.rb b/test/prism/ruby/ripper_test.rb index 8848c6a8c0..6e9dcee4c9 100644 --- a/test/prism/ruby/ripper_test.rb +++ b/test/prism/ruby/ripper_test.rb @@ -111,10 +111,18 @@ module Prism end class ObjectEvents < Translation::Ripper + OBJECT = BasicObject.new Prism::Translation::Ripper::PARSER_EVENTS.each do |event| - define_method(:"on_#{event}") do |*args| - Object.new - end + define_method(:"on_#{event}") { |*args| OBJECT } + end + end + + Fixture.each_for_current_ruby(except: incorrect) do |fixture| + define_method("#{fixture.test_name}_events") do + source = fixture.read + # Similar to test/ripper/assert_parse_files.rb in CRuby + object_events = ObjectEvents.new(source) + assert_nothing_raised { object_events.parse } end end @@ -160,10 +168,6 @@ module Prism def assert_ripper_sexp_raw(source) assert_equal Ripper.sexp_raw(source), Prism::Translation::Ripper.sexp_raw(source) - - # Similar to test/ripper/assert_parse_files.rb in CRuby - object_events = ObjectEvents.new(source) - assert_nothing_raised { object_events.parse } end def assert_ripper_lex(source) |
