Move lib directory to the last of $LOAD_PATH on ruby repository.

https://github.com/rubygems/rubygems/pull/1868 changes the behavior
  of require when it used with -I options. Therefore, the options of
  ruby repository was different from rubygems/rubygems.
This commit is contained in:
Hiroshi SHIBATA 2019-08-16 21:30:32 +09:00
parent ae3002b540
commit f30d38bdd0
No known key found for this signature in database
GPG Key ID: F9CF13417264FAC2

View File

@ -204,6 +204,14 @@ class TestGemRequire < Gem::TestCase
this test, somehow require will load the benchmark in b, and ignore that the this test, somehow require will load the benchmark in b, and ignore that the
stdlib one is already in $LOADED_FEATURES?. Reproducible by running the stdlib one is already in $LOADED_FEATURES?. Reproducible by running the
spaceship_specific_file test before this one" if java_platform? spaceship_specific_file test before this one" if java_platform?
lp = $LOAD_PATH.dup
lib_dir = File.expand_path(File.join(File.dirname(__FILE__), "../../lib"))
if File.exist?(lib_dir)
$LOAD_PATH.delete lib_dir
$LOAD_PATH.push lib_dir
end
a1 = util_spec "a", "1", {"b" => ">= 1"}, "lib/test_gem_require_a.rb" a1 = util_spec "a", "1", {"b" => ">= 1"}, "lib/test_gem_require_a.rb"
b1 = util_spec "b", "1", nil, "lib/benchmark.rb" b1 = util_spec "b", "1", nil, "lib/benchmark.rb"
b2 = util_spec "b", "2", nil, "lib/benchmark.rb" b2 = util_spec "b", "2", nil, "lib/benchmark.rb"
@ -221,6 +229,8 @@ class TestGemRequire < Gem::TestCase
# the same behavior as eager loading would have. # the same behavior as eager loading would have.
assert_equal %w(a-1 b-2), loaded_spec_names assert_equal %w(a-1 b-2), loaded_spec_names
ensure
$LOAD_PATH.replace lp
end end
def test_already_activated_direct_conflict def test_already_activated_direct_conflict