summaryrefslogtreecommitdiff
path: root/test/ruby/test_require.rb
diff options
context:
space:
mode:
authorKoichi Sasada <ko1@atdot.net>2020-01-29 00:50:25 +0900
committerKoichi Sasada <ko1@atdot.net>2020-01-29 00:54:05 +0900
commite7571f163b791d8ca5df389ba97e7d4acadbf480 (patch)
tree1386dd749a1ce4433dcf3c66ad11e784e4626abc /test/ruby/test_require.rb
parent7882c43fc306c1100be8e1648f3d1caa48d50a8a (diff)
restore $LOADED_FEATURES.
Dir.tmpdir can return same directory because of rand() value, so we shouldn't rely on different name.
Diffstat (limited to 'test/ruby/test_require.rb')
-rw-r--r--test/ruby/test_require.rb5
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