summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-17 14:21:57 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-17 14:21:57 +0000
commit6202b67dd21ce1c73398b500aaacd415a6dd6e75 (patch)
tree0ffe9e0ff6203ff742539ab73f020f6271a58878 /test
parent0201900d76c9b05000924dd74b98892db7be3d6e (diff)
* test/ruby/test_dir.rb (TestDir#test_empty?): fix a platform dependent test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53857 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_dir.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/ruby/test_dir.rb b/test/ruby/test_dir.rb
index 8803315..e3429a2 100644
--- a/test/ruby/test_dir.rb
+++ b/test/ruby/test_dir.rb
@@ -335,8 +335,15 @@ class TestDir < Test::Unit::TestCase
def test_empty?
assert_not_send([Dir, :empty?, @root])
assert_send([Dir, :empty?, File.join(@root, "a")])
- open(File.join(@root, "a", "..."), "w") {}
+ tmp = File.join(@root, "a", "A")
+ open(tmp, "w") {}
assert_not_send([Dir, :empty?, File.join(@root, "a")])
+ File.delete(tmp)
+ assert_send([Dir, :empty?, File.join(@root, "a")])
+ unless /mswin|mingw|cygwin/ =~ RUBY_PLATFORM
+ open(File.join(@root, "a", "..."), "w") {}
+ assert_not_send([Dir, :empty?, File.join(@root, "a")])
+ end
assert_raise(Errno::ENOENT) {Dir.empty?(@nodir)}
assert_not_send([Dir, :empty?, File.join(@root, "b")])
end