mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	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:
		
							parent
							
								
									3133a5c971
								
							
						
					
					
						commit
						b5b2bd86f1
					
				
					 1 changed files with 3 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -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
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue