Port test_warn_bootsnap_rubyarchdir_gem.rb to RSpec example

This commit is contained in:
Hiroshi SHIBATA 2024-11-15 14:33:53 +09:00
parent 0afd77d76a
commit 5395afd422
Notes: git 2024-11-15 08:50:47 +00:00
3 changed files with 20 additions and 18 deletions

View File

@ -173,6 +173,26 @@ RSpec.describe "bundled_gems.rb" do
# test_warn_bootsnap.rb:14: warning: ...
end
it "Show warning with bootsnap for gem with native extension" do
script <<-RUBY
gemfile do
source "https://rubygems.org"
# gem "bootsnap", require: false
end
# require 'bootsnap'
# Bootsnap.setup(cache_dir: 'tmp/cache')
# bootsnap expand required feature to full path
# require 'fiddle'
require Gem::BUNDLED_GEMS::ARCHDIR + "fiddle"
RUBY
expect(err).to include(/fiddle was loaded from (.*) from Ruby 3.5.0/)
# TODO: We should assert caller location like below:
# test_warn_bootsnap_rubyarchdir_gem.rb:14: warning: ...
end
it "Don't show warning fiddle/import when fiddle on Gemfile" do
build_lib "fiddle", "1.0.0" do |s|
s.write "lib/fiddle.rb", "puts 'fiddle'"

View File

@ -1,9 +1,5 @@
#!/bin/bash
echo "* Show warning with bootsnap for gem with native extension"
ruby test_warn_bootsnap_rubyarchdir_gem.rb
echo
echo "* Show warning with zeitwerk"
ruby test_warn_zeitwerk.rb
echo

View File

@ -1,14 +0,0 @@
require "bundler"
Bundler::Definition.no_lock = true
require "bundler/inline"
gemfile do
source "https://rubygems.org"
gem "bootsnap", require: false
end
require 'bootsnap'
Bootsnap.setup(cache_dir: 'tmp/cache')
require 'syslog'