Files
ruby/test/prism/fixtures_test.rb
Yusuke EndohandClaude Opus 5.5 9b23d39c44 [ruby/prism] Resync prism as Ruby::Prism
This is the output of

    ruby tool/sync_default_gems.rb prism
    git rm -r lib/prism.rb lib/prism

at https://github.com/ruby/prism/commit/0a5f9c9, with the new mapping:
lib/prism is now lib/ruby/prism, the namespace is rewritten to
Ruby::Prism, and lib/prism/prism.gemspec is no longer imported, so
prism is no longer installed as a default gem.

prism/srcs.mk.in (excluded from the sync) follows the template engine,
now Ruby::Prism::Template: it defines the Ruby module, which does not
exist in BASERUBY older than Ruby 4.0, before loading
templates/template.rb.

Ruby::Prism is the very parser that parsed the running code, no
matter which version of the prism gem is installed; the two can be
loaded side by side (the ruby binary is built with -fvisibility=hidden,
so the gem's pm_* and rb_cPrism* symbols do not collide with the
built-in ones).

[Bug #22379]

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-11 04:27:15 +09:00

41 lines
1.3 KiB
Ruby

# frozen_string_literal: true
return if RUBY_VERSION < "3.2.0"
require_relative "test_helper"
module Ruby::Prism
class FixturesTest < TestCase
except = []
if RUBY_VERSION < "3.3.0"
# Ruby < 3.3.0 cannot parse heredocs where there are leading whitespace
# characters in the heredoc start.
# Example: <<~' EOF' or <<-' EOF'
# https://bugs.ruby-lang.org/issues/19539
except << "heredocs_leading_whitespace.txt"
except << "whitequark/ruby_bug_19539.txt"
# https://bugs.ruby-lang.org/issues/19025
except << "whitequark/numparam_ruby_bug_19025.txt"
# https://bugs.ruby-lang.org/issues/18878
except << "whitequark/ruby_bug_18878.txt"
# https://bugs.ruby-lang.org/issues/19281
except << "whitequark/ruby_bug_19281.txt"
end
# https://bugs.ruby-lang.org/issues/21168#note-5
except << "command_method_call_2.txt"
# https://bugs.ruby-lang.org/issues/21669
except << "4.1/void_value.txt"
# https://bugs.ruby-lang.org/issues/19107
except << "4.1/trailing_comma_after_method_arguments.txt"
# https://bugs.ruby-lang.org/issues/22310
except << "pattern_alternation_non_captures.txt"
Fixture.each_for_current_ruby(except: except) do |fixture|
define_method(fixture.test_name) { assert_valid_syntax(fixture.read) }
end
end
end