diff options
author | Koichi Sasada <ko1@atdot.net> | 2020-01-29 00:50:25 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2020-01-29 00:54:05 +0900 |
commit | e7571f163b791d8ca5df389ba97e7d4acadbf480 (patch) | |
tree | 1386dd749a1ce4433dcf3c66ad11e784e4626abc | |
parent | 7882c43fc306c1100be8e1648f3d1caa48d50a8a (diff) | |
download | ruby-e7571f163b791d8ca5df389ba97e7d4acadbf480.tar.gz |
restore $LOADED_FEATURES.
Dir.tmpdir can return same directory because of rand() value,
so we shouldn't rely on different name.
-rw-r--r-- | test/ruby/test_require.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_require.rb b/test/ruby/test_require.rb index 05dc18cd17..7e53a02fb8 100644 --- a/test/ruby/test_require.rb +++ b/test/ruby/test_require.rb @@ -199,6 +199,7 @@ class TestRequire < Test::Unit::TestCase 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 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 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 end ensure $:.replace(load_path) if load_path + $LOADED_FEATURES.replace loaded_featrures end def test_relative_symlink |