* 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
@ -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>
|
Wed Sep 3 23:33:09 2008 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* transcode.c (rb_transcoding): moved from transcode_data.h.
|
* transcode.c (rb_transcoding): moved from transcode_data.h.
|
||||||
|
@ -44,37 +44,18 @@ class TestEtc < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
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 = []
|
a = []
|
||||||
Etc.passwd {|s| a << s }
|
Etc.passwd {|s| a << s }
|
||||||
b = []
|
b = []
|
||||||
Etc.passwd do |s|
|
Etc.setpwent
|
||||||
b << s
|
while s = Etc.getpwent
|
||||||
s = Etc.getpwent
|
|
||||||
break unless s
|
|
||||||
b << s
|
b << s
|
||||||
end
|
end
|
||||||
|
Etc.endpwent
|
||||||
assert_equal(a, b)
|
assert_equal(a, b)
|
||||||
end
|
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
|
def test_group
|
||||||
Etc.group do |s|
|
Etc.group do |s|
|
||||||
assert_instance_of(String, s.name)
|
assert_instance_of(String, s.name)
|
||||||
@ -106,34 +87,15 @@ class TestEtc < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
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 = []
|
a = []
|
||||||
Etc.group {|s| a << s }
|
Etc.group {|s| a << s }
|
||||||
b = []
|
b = []
|
||||||
Etc.group do |s|
|
Etc.setgrent
|
||||||
b << s
|
while s = Etc.getgrent
|
||||||
s = Etc.getgrent
|
|
||||||
break unless s
|
|
||||||
b << s
|
b << s
|
||||||
end
|
end
|
||||||
|
Etc.endgrent
|
||||||
assert_equal(a, b)
|
assert_equal(a, b)
|
||||||
end
|
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
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user