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
This commit is contained in:
sonots 2017-09-29 17:19:37 +00:00
Родитель 3133a5c971
Коммит b5b2bd86f1
1 изменённых файлов: 3 добавлений и 3 удалений

Просмотреть файл

@ -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