ruby-changes:70072
From: David <ko1@a...>
Date: Mon, 6 Dec 2021 05:25:39 +0900 (JST)
Subject: [ruby-changes:70072] e713552868 (master): [rubygems/rubygems] LOAD_PATH is already reset globally
https://git.ruby-lang.org/ruby.git/commit/?id=e713552868 From e713552868c05fe77a2e3acb825460e5c2bdb53f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...> Date: Mon, 17 Feb 2020 14:02:17 +0100 Subject: [rubygems/rubygems] LOAD_PATH is already reset globally https://github.com/rubygems/rubygems/commit/b0bbb27115 --- test/rubygems/test_require.rb | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/test/rubygems/test_require.rb b/test/rubygems/test_require.rb index 02fbd5e7b17..56774116a92 100644 --- a/test/rubygems/test_require.rb +++ b/test/rubygems/test_require.rb @@ -78,8 +78,6 @@ class TestGemRequire < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_require.rb#L78 FileUtils.mkdir_p File.dirname c_rb File.open(c_rb, 'w') {|f| f.write "class Object; HELLO = 'world' end" } - lp = $LOAD_PATH.dup - # Pretend to provide a commandline argument that overrides a file in gem b $LOAD_PATH.unshift dash_i_arg @@ -88,7 +86,6 @@ class TestGemRequire < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_require.rb#L86 assert_equal "world", ::Object::HELLO assert_equal %w[a-1 b-1], loaded_spec_names ensure - $LOAD_PATH.replace lp Object.send :remove_const, :HELLO if Object.const_defined? :HELLO end @@ -122,8 +119,6 @@ class TestGemRequire < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_require.rb#L119 assert_require 'test_gem_require_a' - lp = $LOAD_PATH.dup - # Pretend to provide a commandline argument that overrides a file in gem b $LOAD_PATH.unshift dash_i_arg @@ -132,7 +127,6 @@ class TestGemRequire < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_require.rb#L127 assert_equal "world", ::Object::HELLO assert_equal %w[a-1 b-1], loaded_spec_names ensure - $LOAD_PATH.replace lp Object.send :remove_const, :HELLO if Object.const_defined? :HELLO end @@ -143,16 +137,10 @@ class TestGemRequire < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_require.rb#L137 dash_i_ext_arg = util_install_extension_file('a') dash_i_lib_arg = util_install_ruby_file('a') - lp = $LOAD_PATH.dup - - begin - $LOAD_PATH.unshift dash_i_lib_arg - $LOAD_PATH.unshift dash_i_ext_arg - assert_require 'a' - assert_match(/a\.rb$/, $LOADED_FEATURES.last) - ensure - $LOAD_PATH.replace lp - end + $LOAD_PATH.unshift dash_i_lib_arg + $LOAD_PATH.unshift dash_i_ext_arg + assert_require 'a' + assert_match(/a\.rb$/, $LOADED_FEATURES.last) end def test_concurrent_require -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/