Skip to content

Commit 435ee62

Browse files
headiusandrykonchin
authored andcommitted
Don't map pathname to pathname.so on JRuby
JRuby never loads extensions as .so and pathname is provided as a pathname.rb.
1 parent 29305b0 commit 435ee62

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

core/kernel/require_spec.rb

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,22 @@
3838
end
3939
features.reject! { |feature| feature.end_with?('-fake') }
4040

41-
code = <<~RUBY
42-
loaded_feature_base = $\".map{|f| File.basename(f, '.*')}
43-
required = begin
44-
require(#{feature_require.inspect})
45-
rescue LoadError
46-
"error"
47-
end
48-
feature = loaded_feature_base.include?(#{feature.inspect})
49-
p({required:, feature:})
50-
RUBY
51-
output = ruby_exe(code, options: '--disable-gems').chomp
52-
output.should == "{required: false, feature: true}"
41+
features.sort.should == provided.sort
42+
43+
requires = provided
44+
ruby_version_is "4.0" do
45+
if RUBY_ENGINE != "jruby"
46+
requires = requires.map { |f| f == "pathname" ? "pathname.so" : f }
47+
end
48+
end
49+
50+
ruby_version_is "4.1" do
51+
requires = requires.map { |f| f == "monitor" ? "monitor.so" : f }
5352
end
53+
54+
code = requires.map { |f| "puts require #{f.inspect}\n" }.join
55+
required = ruby_exe(code, options: '--disable-gems')
56+
required.should == "false\n" * requires.size
5457
end
5558

5659
it_behaves_like :kernel_require_basic, :require, CodeLoadingSpecs::Method.new

0 commit comments

Comments
 (0)