summaryrefslogtreecommitdiff
path: root/test/ruby/test_namespace.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2025-10-29 19:41:51 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2025-10-29 19:41:51 +0900
commit606abf2faba96e301e8f7445fc9fcc272cbf6b9e (patch)
treea62a3e216f443e1eda25c2e7044ab1a3046f3858 /test/ruby/test_namespace.rb
parente49e0bb6c9b4ade9d8fb615a1f7cc65f9ea13a7f (diff)
Clean extension libraries copied for the namespace
Diffstat (limited to 'test/ruby/test_namespace.rb')
-rw-r--r--test/ruby/test_namespace.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/ruby/test_namespace.rb b/test/ruby/test_namespace.rb
index bfbbe38e05..6bc529b281 100644
--- a/test/ruby/test_namespace.rb
+++ b/test/ruby/test_namespace.rb
@@ -668,7 +668,9 @@ class TestNamespace < Test::Unit::TestCase
end
def test_root_and_main_methods
- assert_separately([ENV_ENABLE_NAMESPACE], __FILE__, __LINE__, "#{<<~"begin;"}\n#{<<~'end;'}", ignore_stderr: true)
+ tmp = Dir.mktmpdir("namespace_so")
+
+ assert_separately([{"TMPDIR"=>tmp, **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
@@ -690,5 +692,8 @@ class TestNamespace < Test::Unit::TestCase
assert !$LOADED_FEATURES.include?("/tmp/barbaz")
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)
end
end