summaryrefslogtreecommitdiff
path: root/test/etc
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-03 14:54:14 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-03 14:54:14 +0000
commit65b1544649bba7ce6c3c06f55a15d33bb120e135 (patch)
tree884b50e75180974e394823daaf67b20581c42a4e /test/etc
parent1afc1b7bc806c66786b90cc6c6a764f71b4c251f (diff)
downloadbundler-65b1544649bba7ce6c3c06f55a15d33bb120e135.tar.gz
* test/etc/test_etc.rb: check only typical use of
setpwent/getpwent/endpwent and setgrent/getgrent/endgrent. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19098 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/etc')
-rw-r--r--test/etc/test_etc.rb54
1 files changed, 8 insertions, 46 deletions
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