summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi SHIBATA <[email protected]>2024-11-15 14:28:05 +0900
committerHiroshi SHIBATA <[email protected]>2024-11-15 17:50:24 +0900
commit0afd77d76ac9eb0ad65b841dc8eb7b68d399a3cb (patch)
tree311eca9e891fc1fac0c6fe4a895d4244d1f9d071
parentb4d8e90c2a9a6e6fd6d6e892a4b520a36ed131b6 (diff)
Port test_warn_bootsnap.rb to RSpec example
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/12098
-rw-r--r--spec/bundler/bundled_gems_spec.rb20
-rwxr-xr-xtool/test_for_warn_bundled_gems/test.sh4
-rw-r--r--tool/test_for_warn_bundled_gems/test_warn_bootsnap.rb14
3 files changed, 20 insertions, 18 deletions
diff --git a/spec/bundler/bundled_gems_spec.rb b/spec/bundler/bundled_gems_spec.rb
index ccd2161eb2..16c67e53ad 100644
--- a/spec/bundler/bundled_gems_spec.rb
+++ b/spec/bundler/bundled_gems_spec.rb
@@ -153,6 +153,26 @@ RSpec.describe "bundled_gems.rb" do
expect(err).to be_empty
end
+ it "Show warning with bootsnap cases" 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 'csv'
+ require Gem::BUNDLED_GEMS::LIBDIR + 'ostruct'
+ RUBY
+
+ expect(err).to include(/ostruct was loaded from (.*) from Ruby 3.5.0/)
+ # TODO: We should assert caller location like below:
+ # test_warn_bootsnap.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 27efaad551..23e2a01189 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"
-ruby test_warn_bootsnap.rb
-echo
-
echo "* Show warning with bootsnap for gem with native extension"
ruby test_warn_bootsnap_rubyarchdir_gem.rb
echo
diff --git a/tool/test_for_warn_bundled_gems/test_warn_bootsnap.rb b/tool/test_for_warn_bundled_gems/test_warn_bootsnap.rb
deleted file mode 100644
index 230ed3ece9..0000000000
--- a/tool/test_for_warn_bundled_gems/test_warn_bootsnap.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 'csv'