summaryrefslogtreecommitdiff
path: root/test/etc
diff options
context:
space:
mode:
authorsonots <sonots@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-29 17:19:37 +0000
committersonots <sonots@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-29 17:19:37 +0000
commitb5b2bd86f1bf0a3c97e9d193781d8f72ee0bd4d8 (patch)
tree32b9f8769e87c2fd2482e019266d3f705ba8bb40 /test/etc
parent3133a5c971f77531aa33887c1d180d5bfdde0c33 (diff)
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
Diffstat (limited to 'test/etc')
-rw-r--r--test/etc/test_etc.rb6
1 files changed, 3 insertions, 3 deletions
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