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

ruby-changes:7577

From: mame <ko1@a...>
Date: Wed, 3 Sep 2008 23:55:35 +0900 (JST)
Subject: [ruby-changes:7577] Ruby:r19098 (trunk): * test/etc/test_etc.rb: check only typical use of

mame	2008-09-03 23:54:14 +0900 (Wed, 03 Sep 2008)

  New Revision: 19098

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19098

  Log:
    * test/etc/test_etc.rb: check only typical use of
      setpwent/getpwent/endpwent and setgrent/getgrent/endgrent.

  Modified files:
    trunk/ChangeLog
    trunk/test/etc/test_etc.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 19097)
+++ ChangeLog	(revision 19098)
@@ -1,3 +1,8 @@
+Wed Sep  3 23:52:47 2008  Yusuke Endoh  <mame@t...>
+
+	* test/etc/test_etc.rb: check only typical use of
+	  setpwent/getpwent/endpwent and setgrent/getgrent/endgrent.
+
 Wed Sep  3 23:33:09 2008  Tanaka Akira  <akr@f...>
 
 	* transcode.c (rb_transcoding): moved from transcode_data.h.
Index: test/etc/test_etc.rb
===================================================================
--- test/etc/test_etc.rb	(revision 19097)
+++ test/etc/test_etc.rb	(revision 19098)
@@ -44,37 +44,18 @@
     end
   end
 
-  def test_setpwent
+  def test_passwd_with_low_level_api
     a = []
-    Etc.passwd do |s|
-      a << s
-      Etc.setpwent if a.size == 3
-    end
-    assert_equal(a[0, 3], a[3, 3]) if a.size >= 6
-  end
-
-  def test_getpwent
-    a = []
     Etc.passwd {|s| a << s }
     b = []
-    Etc.passwd do |s|
+    Etc.setpwent
+    while s = Etc.getpwent
       b << s
-      s = Etc.getpwent
-      break unless s
-      b << s
     end
+    Etc.endpwent
     assert_equal(a, b)
   end
 
-  def test_endpwent
-    a = []
-    Etc.passwd do |s|
-      a << s
-      Etc.endpwent if a.size == 3
-    end
-    assert_equal(a[0, 3], a[3, 3]) if a.size >= 6
-  end
-
   def test_group
     Etc.group do |s|
       assert_instance_of(String, s.name)
@@ -106,34 +87,15 @@
     end
   end
 
-  def test_setgrent
+  def test_group_with_low_level_api
     a = []
-    Etc.group do |s|
-      a << s
-      Etc.setgrent if a.size == 3
-    end
-    assert_equal(a[0, 3], a[3, 3]) if a.size >= 6
-  end
-
-  def test_getgrent
-    a = []
     Etc.group {|s| a << s }
     b = []
-    Etc.group do |s|
+    Etc.setgrent
+    while s = Etc.getgrent
       b << s
-      s = Etc.getgrent
-      break unless s
-      b << s
     end
+    Etc.endgrent
     assert_equal(a, b)
   end
-
-  def test_endgrent
-    a = []
-    Etc.group do |s|
-      a << s
-      Etc.endgrent if a.size == 3
-    end
-    assert_equal(a[0, 3], a[3, 3]) if a.size >= 6
-  end
 end

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

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