[前][次][番号順一覧][スレッド一覧]

ruby-changes:57107

From: Hiroshi <ko1@a...>
Date: Sat, 17 Aug 2019 07:57:26 +0900 (JST)
Subject: [ruby-changes:57107] Hiroshi SHIBATA: f30d38bdd0 (master): Move lib directory to the last of $LOAD_PATH on ruby repository.

https://git.ruby-lang.org/ruby.git/commit/?id=f30d38bdd0

From f30d38bdd08d241f8c3c1768069911e627f955f8 Mon Sep 17 00:00:00 2001
From: Hiroshi SHIBATA <hsbt@r...>
Date: Fri, 16 Aug 2019 21:30:32 +0900
Subject: 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.

diff --git a/test/rubygems/test_require.rb b/test/rubygems/test_require.rb
index b341249..a0c272e 100644
--- a/test/rubygems/test_require.rb
+++ b/test/rubygems/test_require.rb
@@ -204,6 +204,14 @@ class TestGemRequire < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_require.rb#L204
       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
       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"
     b1 = util_spec "b", "1", nil, "lib/benchmark.rb"
     b2 = util_spec "b", "2", nil, "lib/benchmark.rb"
@@ -221,6 +229,8 @@ class TestGemRequire < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_require.rb#L229
     # the same behavior as eager loading would have.
 
     assert_equal %w(a-1 b-2), loaded_spec_names
+  ensure
+    $LOAD_PATH.replace lp
   end
 
   def test_already_activated_direct_conflict
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]