[前][次][番号順一覧][スレッド一覧]

ruby-changes:47948

From: sonots <ko1@a...>
Date: Sat, 30 Sep 2017 02:19:41 +0900 (JST)
Subject: [ruby-changes:47948] sonots:r60063 (trunk): test_etc.rb: fix test_getgrnam for duplicated group names

sonots	2017-09-30 02:19:37 +0900 (Sat, 30 Sep 2017)

  New Revision: 60063

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60063

  Log:
    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]

  Modified files:
    trunk/test/etc/test_etc.rb
Index: test/etc/test_etc.rb
===================================================================
--- test/etc/test_etc.rb	(revision 60062)
+++ test/etc/test_etc.rb	(revision 60063)
@@ -97,12 +97,12 @@ class TestEtc < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/etc/test_etc.rb#L97
   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
 

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]