ruby-changes:59863
From: Koichi <ko1@a...>
Date: Wed, 29 Jan 2020 01:01:16 +0900 (JST)
Subject: [ruby-changes:59863] e7571f163b (master): restore $LOADED_FEATURES.
https://git.ruby-lang.org/ruby.git/commit/?id=e7571f163b From e7571f163b791d8ca5df389ba97e7d4acadbf480 Mon Sep 17 00:00:00 2001 From: Koichi Sasada <ko1@a...> Date: Wed, 29 Jan 2020 00:50:25 +0900 Subject: restore $LOADED_FEATURES. Dir.tmpdir can return same directory because of rand() value, so we shouldn't rely on different name. diff --git a/test/ruby/test_require.rb b/test/ruby/test_require.rb index 05dc18c..7e53a02 100644 --- a/test/ruby/test_require.rb +++ b/test/ruby/test_require.rb @@ -199,6 +199,7 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L199 end def assert_syntax_error_backtrace + loaded_features = $LOADED_FEATURES.dup Dir.mktmpdir do |tmp| req = File.join(tmp, "test.rb") File.write(req, ",\n") @@ -208,6 +209,7 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L209 assert_not_nil(bt = e.backtrace, "no backtrace") assert_not_empty(bt.find_all {|b| b.start_with? __FILE__}, proc {bt.inspect}) end + $LOADED_FEATURES.replace loaded_features end def test_require_syntax_error @@ -381,6 +383,8 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L383 def test_relative load_path = $:.dup + loaded_featrures = $LOADED_FEATURES.dup + $:.delete(".") Dir.mktmpdir do |tmp| Dir.chdir(tmp) do @@ -400,6 +404,7 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L404 end ensure $:.replace(load_path) if load_path + $LOADED_FEATURES.replace loaded_featrures end def test_relative_symlink -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/