diff options
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_namespace.rb | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/test/ruby/test_namespace.rb b/test/ruby/test_namespace.rb index 6bc529b281..5a014ad714 100644 --- a/test/ruby/test_namespace.rb +++ b/test/ruby/test_namespace.rb @@ -668,9 +668,7 @@ class TestNamespace < Test::Unit::TestCase end def test_root_and_main_methods - tmp = Dir.mktmpdir("namespace_so") - - assert_separately([{"TMPDIR"=>tmp, **ENV_ENABLE_NAMESPACE}], __FILE__, __LINE__, "#{<<~"begin;"}\n#{<<~'end;'}", ignore_stderr: true) + assert_separately([ENV_ENABLE_NAMESPACE], __FILE__, __LINE__, "#{<<~"begin;"}\n#{<<~'end;'}", ignore_stderr: true) begin; pend unless Namespace.respond_to?(:root) and Namespace.respond_to?(:main) # for RUBY_DEBUG > 0 @@ -693,7 +691,8 @@ class TestNamespace < Test::Unit::TestCase assert !Object.const_defined?(:FooClass) end; ensure - File.unlink(*Dir.glob("_ruby_ns_*."+RbConfig::CONFIG["DLEXT"], base: tmp).map {|so| "#{tmp}/#{so}"}) - Dir.rmdir(tmp) + tmp = ENV["TMPDIR"] || ENV["TMP"] || Etc.systmpdir || "/tmp" + pat = "_ruby_ns_*."+RbConfig::CONFIG["DLEXT"] + File.unlink(*Dir.glob(pat, base: tmp).map {|so| "#{tmp}/#{so}"}) end end |
