mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
file.c: File.empty?
* file.c (Init_File): add alias File.empty? to File.zero?. [Feature #9969] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54559 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
134d1ce892
commit
096137e84f
3 changed files with 13 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
Wed Apr 13 14:47:47 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* file.c (Init_File): add alias File.empty? to File.zero?.
|
||||
[Feature #9969]
|
||||
|
||||
Wed Apr 13 14:36:24 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* parse.y (assign_in_cond): allow multiple assignment in
|
||||
|
|
1
file.c
1
file.c
|
@ -5886,6 +5886,7 @@ Init_File(void)
|
|||
define_filetest_function("executable_real?", rb_file_executable_real_p, 1);
|
||||
define_filetest_function("file?", rb_file_file_p, 1);
|
||||
define_filetest_function("zero?", rb_file_zero_p, 1);
|
||||
define_filetest_function("empty?", rb_file_zero_p, 1);
|
||||
define_filetest_function("size?", rb_file_size_p, 1);
|
||||
define_filetest_function("size", rb_file_s_size, 1);
|
||||
define_filetest_function("owned?", rb_file_owned_p, 1);
|
||||
|
|
|
@ -399,6 +399,13 @@ class TestFileExhaustive < Test::Unit::TestCase
|
|||
assert_file.not_zero?(nofile)
|
||||
end
|
||||
|
||||
def test_empty_p
|
||||
assert_nothing_raised { File.empty?(@dir) }
|
||||
assert_file.not_empty?(regular_file)
|
||||
assert_file.empty?(zerofile)
|
||||
assert_file.not_empty?(nofile)
|
||||
end
|
||||
|
||||
def test_size_p
|
||||
assert_nothing_raised { File.size?(@dir) }
|
||||
assert_equal(3, File.size?(regular_file))
|
||||
|
|
Loading…
Reference in a new issue