From b5b2bd86f1bf0a3c97e9d193781d8f72ee0bd4d8 Mon Sep 17 00:00:00 2001 From: sonots Date: Fri, 29 Sep 2017 17:19:37 +0000 Subject: test_etc.rb: fix test_getgrnam for duplicated group names * test/etc/test_etc.rb: Etc.getgrnam would not return the first entry in the order of Etc.group for duplicated group names. follow-up: [Bug #6935] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60063 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/etc/test_etc.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/etc') diff --git a/test/etc/test_etc.rb b/test/etc/test_etc.rb index f93c5a0e11..365c27021c 100644 --- a/test/etc/test_etc.rb +++ b/test/etc/test_etc.rb @@ -97,12 +97,12 @@ class TestEtc < Test::Unit::TestCase end def test_getgrnam - groups = {} + groups = Hash.new {[]} Etc.group do |s| - groups[s.name] ||= s.gid unless /\A\+/ =~ s.name + groups[s.name] |= [s.gid] unless /\A\+/ =~ s.name end groups.each_pair do |n, s| - assert_equal(s, Etc.getgrnam(n).gid) + assert_include(s, Etc.getgrnam(n).gid) end end -- cgit v1.2.3