summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-17 15:14:03 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-02-17 15:14:03 +0000
commitbe9699a250b34dcaeb76d3dbba92ff484a81315b (patch)
treefc7b684a599b794e3ad2424376a895507c15886c /test/ruby
parent5b24766d69001f6c4e4635aead60b282e78c5a1f (diff)
test_dir.rb: Dir.empty? with dot file
* test/ruby/test_dir.rb (test_empty): check with a dot file. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_dir.rb17
1 files changed, 8 insertions, 9 deletions
diff --git a/test/ruby/test_dir.rb b/test/ruby/test_dir.rb
index e3429a2..f976dbb 100644
--- a/test/ruby/test_dir.rb
+++ b/test/ruby/test_dir.rb
@@ -334,15 +334,14 @@ class TestDir < Test::Unit::TestCase
def test_empty?
assert_not_send([Dir, :empty?, @root])
- assert_send([Dir, :empty?, File.join(@root, "a")])
- 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")])
+ a = File.join(@root, "a")
+ assert_send([Dir, :empty?, a])
+ %w[A .dot].each do |tmp|
+ tmp = File.join(a, tmp)
+ open(tmp, "w") {}
+ assert_not_send([Dir, :empty?, a])
+ File.delete(tmp)
+ assert_send([Dir, :empty?, a])
end
assert_raise(Errno::ENOENT) {Dir.empty?(@nodir)}
assert_not_send([Dir, :empty?, File.join(@root, "b")])