mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
5b24766d69
commit
be9699a250
1 changed files with 8 additions and 9 deletions
|
@ -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")])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue