[前][次][番号順一覧][スレッド一覧]

ruby-changes:42485

From: nobu <ko1@a...>
Date: Wed, 13 Apr 2016 13:51:13 +0900 (JST)
Subject: [ruby-changes:42485] nobu:r54559 (trunk): file.c: File.empty?

nobu	2016-04-13 14:47:49 +0900 (Wed, 13 Apr 2016)

  New Revision: 54559

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54559

  Log:
    file.c: File.empty?
    
    * file.c (Init_File): add alias File.empty? to File.zero?.
      [Feature #9969]

  Modified files:
    trunk/ChangeLog
    trunk/file.c
    trunk/test/ruby/test_file_exhaustive.rb
Index: test/ruby/test_file_exhaustive.rb
===================================================================
--- test/ruby/test_file_exhaustive.rb	(revision 54558)
+++ test/ruby/test_file_exhaustive.rb	(revision 54559)
@@ -399,6 +399,13 @@ class TestFileExhaustive < Test::Unit::T https://github.com/ruby/ruby/blob/trunk/test/ruby/test_file_exhaustive.rb#L399
     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))
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 54558)
+++ ChangeLog	(revision 54559)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Apr 13 14:47:47 2016  Nobuyoshi Nakada  <nobu@r...>
+
+	* file.c (Init_File): add alias File.empty? to File.zero?.
+	  [Feature #9969]
+
 Wed Apr 13 14:36:24 2016  Nobuyoshi Nakada  <nobu@r...>
 
 	* parse.y (assign_in_cond): allow multiple assignment in
Index: file.c
===================================================================
--- file.c	(revision 54558)
+++ file.c	(revision 54559)
@@ -5886,6 +5886,7 @@ Init_File(void) https://github.com/ruby/ruby/blob/trunk/file.c#L5886
     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);

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]