aboutsummaryrefslogtreecommitdiffstats
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
commita4eecff19ed6e0f13ef09c706243df0de70af209 (patch)
tree32b9f8769e87c2fd2482e019266d3f705ba8bb40 /test/etc
parentbba96641a68e2b7c4599f9c37fb1082466204a8f (diff)
downloadruby-a4eecff19ed6e0f13ef09c706243df0de70af209.tar.gz
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