summaryrefslogtreecommitdiff
path: root/test/test_tmpdir.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-07-16 17:45:08 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-09-14 18:22:37 +0900
commitedb5c67195129e1d10f329edb55e486e1874b20e (patch)
tree730b762e56096970b2093f851fd8eb99cd5d1a24 /test/test_tmpdir.rb
parentdf1c035d0381e41a78ebc55b0450bab39b542cf2 (diff)
[ruby/tmpdir] Warn when environment variables skipped (fixes #2)
https://github.com/ruby/tmpdir/commit/af7b020a89
Diffstat (limited to 'test/test_tmpdir.rb')
-rw-r--r--test/test_tmpdir.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/test_tmpdir.rb b/test/test_tmpdir.rb
index 7cee2e1..c56fd5f 100644
--- a/test/test_tmpdir.rb
+++ b/test/test_tmpdir.rb
@@ -21,16 +21,16 @@ class TestTmpdir < Test::Unit::TestCase
envs.each do |e|
tmpdirx = File.join(tmpdir, e)
ENV[e] = tmpdirx
- assert_not_equal(tmpdirx, Dir.tmpdir)
+ assert_not_equal(tmpdirx, assert_warn('') {Dir.tmpdir})
File.write(tmpdirx, "")
- assert_not_equal(tmpdirx, Dir.tmpdir)
+ assert_not_equal(tmpdirx, assert_warn(/not a directory/) {Dir.tmpdir})
File.unlink(tmpdirx)
ENV[e] = tmpdir
assert_equal(tmpdir, Dir.tmpdir)
File.chmod(0555, tmpdir)
- assert_not_equal(tmpdir, Dir.tmpdir)
+ assert_not_equal(tmpdir, assert_warn(/not writable/) {Dir.tmpdir})
File.chmod(0777, tmpdir)
- assert_not_equal(tmpdir, Dir.tmpdir)
+ assert_not_equal(tmpdir, assert_warn(/world-writable/) {Dir.tmpdir})
newdir = Dir.mktmpdir("d", tmpdir) do |dir|
assert_file.directory? dir
assert_equal(tmpdir, File.dirname(dir))