summaryrefslogtreecommitdiff
path: root/test/test_tmpdir.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_tmpdir.rb')
-rw-r--r--test/test_tmpdir.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/test_tmpdir.rb b/test/test_tmpdir.rb
new file mode 100644
index 0000000..9ef22e3
--- /dev/null
+++ b/test/test_tmpdir.rb
@@ -0,0 +1,20 @@
+require 'test/unit'
+require 'tmpdir'
+
+class TestTmpdir < Test::Unit::TestCase
+ def test_world_writable
+ Dir.mktmpdir do |tmpdir|
+ # ToDo: fix for parallel test
+ olddir, ENV["TMPDIR"] = ENV["TMPDIR"], tmpdir
+ begin
+ assert_equal(tmpdir, Dir.tmpdir)
+ File.chmod(0777, tmpdir)
+ assert_not_equal(tmpdir, Dir.tmpdir)
+ File.chmod(01777, tmpdir)
+ assert_equal(tmpdir, Dir.tmpdir)
+ ensure
+ ENV["TMPDIR"] = olddir
+ end
+ end
+ end
+end