mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
1afc1b7bc8
commit
65b1544649
2 changed files with 13 additions and 46 deletions
|
@ -1,3 +1,8 @@
|
|||
Wed Sep 3 23:52:47 2008 Yusuke Endoh <mame@tsg.ne.jp>
|
||||
|
||||
* 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@fsij.org>
|
||||
|
||||
* transcode.c (rb_transcoding): moved from transcode_data.h.
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue