diff options
| author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2024-11-15 14:33:53 +0900 |
|---|---|---|
| committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2024-11-15 17:50:24 +0900 |
| commit | 5395afd42239255ff5fb76f74c5de505af60e7d6 (patch) | |
| tree | 8534854e990059d78a7c47febd4e8bf5a5b5dfc7 | |
| parent | 0afd77d76ac9eb0ad65b841dc8eb7b68d399a3cb (diff) | |
Port test_warn_bootsnap_rubyarchdir_gem.rb to RSpec example
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12098
| -rw-r--r-- | spec/bundler/bundled_gems_spec.rb | 20 | ||||
| -rwxr-xr-x | tool/test_for_warn_bundled_gems/test.sh | 4 | ||||
| -rw-r--r-- | tool/test_for_warn_bundled_gems/test_warn_bootsnap_rubyarchdir_gem.rb | 14 |
3 files changed, 20 insertions, 18 deletions
diff --git a/spec/bundler/bundled_gems_spec.rb b/spec/bundler/bundled_gems_spec.rb index 16c67e53ad..66e90a11a5 100644 --- a/spec/bundler/bundled_gems_spec.rb +++ b/spec/bundler/bundled_gems_spec.rb @@ -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'" diff --git a/tool/test_for_warn_bundled_gems/test.sh b/tool/test_for_warn_bundled_gems/test.sh index 23e2a01189..fe9ea00f5d 100755 --- a/tool/test_for_warn_bundled_gems/test.sh +++ b/tool/test_for_warn_bundled_gems/test.sh @@ -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 diff --git a/tool/test_for_warn_bundled_gems/test_warn_bootsnap_rubyarchdir_gem.rb b/tool/test_for_warn_bundled_gems/test_warn_bootsnap_rubyarchdir_gem.rb deleted file mode 100644 index 866da9c065..0000000000 --- a/tool/test_for_warn_bundled_gems/test_warn_bootsnap_rubyarchdir_gem.rb +++ /dev/null @@ -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' |
