ruby-changes:61745
From: David <ko1@a...>
Date: Wed, 17 Jun 2020 21:17:22 +0900 (JST)
Subject: [ruby-changes:61745] 106d616cc8 (master): Make sure to only reset "dummy" $LOADED_FEATURES
https://git.ruby-lang.org/ruby.git/commit/?id=106d616cc8 From 106d616cc8a5c95a2944f9ea3d7f99ee54042cdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= <deivid.rodriguez@r...> Date: Tue, 16 Jun 2020 16:26:31 +0200 Subject: Make sure to only reset "dummy" $LOADED_FEATURES Namely, those generated under `/tmp`. The previous approach was brittle and broken in the case of ruby-core, because under that setup, the current folder is in the original `$LOAD_PATH`, and dummy features are created under `./tmp`, so they were failing to be reset. diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb index bb8355f..9e1c8ea 100644 --- a/lib/rubygems/test_case.rb +++ b/lib/rubygems/test_case.rb @@ -429,11 +429,8 @@ class Gem::TestCase < Minitest::Test https://github.com/ruby/ruby/blob/trunk/lib/rubygems/test_case.rb#L429 $LOAD_PATH.replace @orig_LOAD_PATH if @orig_LOAD_PATH if @orig_LOADED_FEATURES if @orig_LOAD_PATH - paths = @orig_LOAD_PATH.map {|path| File.join(File.expand_path(path), "/") } ($LOADED_FEATURES - @orig_LOADED_FEATURES).each do |feat| - unless paths.any? {|path| feat.start_with?(path) } - $LOADED_FEATURES.delete(feat) - end + $LOADED_FEATURES.delete(feat) if feat.start_with?(@tmp) end else $LOADED_FEATURES.replace @orig_LOADED_FEATURES -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/