1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* test/etc/test_etc.rb(test_getpwnam, test_getgrgid, test_getgrnam):

support an envirionment that has duplicative entries.  a patch from
  Tomoyuki Chikanaga <chikanag at nippon-control-system.co.jp> in
  [ruby-dev:37882].


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22021 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mame 2009-02-03 15:39:44 +00:00
parent ee3c53a7a9
commit c07b4ef145
2 changed files with 20 additions and 9 deletions

View file

@ -1,3 +1,10 @@
Wed Feb 4 00:32:59 2009 Yusuke Endoh <mame@tsg.ne.jp>
* test/etc/test_etc.rb(test_getpwnam, test_getgrgid, test_getgrnam):
support an envirionment that has duplicative entries. a patch from
Tomoyuki Chikanaga <chikanag at nippon-control-system.co.jp> in
[ruby-dev:37882].
Wed Feb 4 00:17:52 2009 Tanaka Akira <akr@fsij.org>
* ext/socket/lib/socket.rb (Socket.tcp_server_sockets_port0): skip

View file

@ -37,9 +37,9 @@ class TestEtc < Test::Unit::TestCase
end
def test_getpwnam
passwd = []
Etc.passwd {|s| passwd << s }
passwd.each do |s|
passwd = {}
Etc.passwd {|s| passwd[s.name] = s unless passwd[s.name] }
passwd.values.each do |s|
assert_equal(s, Etc.getpwnam(s.name))
end
end
@ -67,22 +67,26 @@ class TestEtc < Test::Unit::TestCase
end
def test_getgrgid
groups = []
groups = {}
Etc.group do |s|
groups << s
unless groups[s.gid]
groups[s.gid] = s
end
end
groups.each do |s|
groups.values.each do |s|
assert_equal(s, Etc.getgrgid(s.gid))
assert_equal(s, Etc.getgrgid) if Process.egid == s.gid
end
end
def test_getgrnam
groups = []
groups = {}
Etc.group do |s|
groups << s
unless groups[s.name]
groups[s.name] = s
end
end
groups.each do |s|
groups.values.each do |s|
assert_equal(s, Etc.getgrnam(s.name))
end
end