diff options
Diffstat (limited to 'test/test_tmpdir.rb')
-rw-r--r-- | test/test_tmpdir.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/test_tmpdir.rb b/test/test_tmpdir.rb index 62b4abfa1a..842b2ded90 100644 --- a/test/test_tmpdir.rb +++ b/test/test_tmpdir.rb @@ -2,6 +2,25 @@ require 'test/unit' require 'tmpdir' class TestTmpdir < Test::Unit::TestCase + def test_tmpdir_modifiable + tmpdir = Dir.tmpdir + assert_equal(false, tmpdir.frozen?) + tmpdir_org = tmpdir.dup + tmpdir << "foo" + assert_equal(tmpdir_org, Dir.tmpdir) + end + + def test_tmpdir_modifiable_safe + Thread.new { + $SAFE = 1 + tmpdir = Dir.tmpdir + assert_equal(false, tmpdir.frozen?) + tmpdir_org = tmpdir.dup + tmpdir << "foo" + assert_equal(tmpdir_org, Dir.tmpdir) + }.join + end + def test_world_writable skip "no meaning on this platform" if /mswin|mingw/ =~ RUBY_PLATFORM Dir.mktmpdir do |tmpdir| |