diff --git a/ChangeLog b/ChangeLog index 0d08c786c2..bd0abe9b8c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed Sep 3 23:52:47 2008 Yusuke Endoh + + * 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 * transcode.c (rb_transcoding): moved from transcode_data.h. diff --git a/test/etc/test_etc.rb b/test/etc/test_etc.rb index 6fc7c6092b..712961939c 100644 --- a/test/etc/test_etc.rb +++ b/test/etc/test_etc.rb @@ -44,37 +44,18 @@ class TestEtc < Test::Unit::TestCase end end - def test_setpwent - 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 + def test_passwd_with_low_level_api a = [] Etc.passwd {|s| a << s } b = [] - Etc.passwd do |s| - b << s - s = Etc.getpwent - break unless s + Etc.setpwent + while s = Etc.getpwent 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 @@ class TestEtc < Test::Unit::TestCase end end - def test_setgrent - 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 + def test_group_with_low_level_api a = [] Etc.group {|s| a << s } b = [] - Etc.group do |s| - b << s - s = Etc.getgrent - break unless s + Etc.setgrent + while s = Etc.getgrent 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