diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-05 03:29:08 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-05 03:29:08 +0000 |
commit | 9373c5efb993dd8cae0526118805449b19af2c22 (patch) | |
tree | 503c05d65e51b27e31bc0dc40e7de44571fb5099 /test/pathname | |
parent | 19e59705f837f621a7266d6c3d8a9a54bed534bf (diff) |
Pathname#empty? implemented.
* ext/pathname/pathname.c (Pathname#empty?): New method.
[ruby-core:76404] [Feature#12596] Proposed by John Backus.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56571 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/pathname')
-rw-r--r-- | test/pathname/test_pathname.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/pathname/test_pathname.rb b/test/pathname/test_pathname.rb index 2690a3f6de..848d4e4190 100644 --- a/test/pathname/test_pathname.rb +++ b/test/pathname/test_pathname.rb @@ -1212,6 +1212,20 @@ class TestPathname < Test::Unit::TestCase } end + def test_empty? + with_tmpchdir('rubytest-pathname') {|dir| + open("nonemptyfile", "w") {|f| f.write "abc" } + open("emptyfile", "w") {|f| } + Dir.mkdir("nonemptydir") + open("nonemptydir/somefile", "w") {|f| } + Dir.mkdir("emptydir") + assert_equal(true, Pathname("emptyfile").empty?) + assert_equal(false, Pathname("nonemptyfile").empty?) + assert_equal(true, Pathname("emptydir").empty?) + assert_equal(false, Pathname("nonemptydir").empty?) + } + end + def test_s_glob with_tmpchdir('rubytest-pathname') {|dir| open("f", "w") {|f| f.write "abc" } |