test_utils: add test_which_all
This commit is contained in:
		
							parent
							
								
									66c0b06d72
								
							
						
					
					
						commit
						17a57f529b
					
				@ -42,6 +42,20 @@ class UtilTests < Homebrew::TestCase
 | 
				
			|||||||
      which(File.basename(cmd), "~~#{File::PATH_SEPARATOR}#{File.dirname(cmd)}")
 | 
					      which(File.basename(cmd), "~~#{File::PATH_SEPARATOR}#{File.dirname(cmd)}")
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  def test_which_all
 | 
				
			||||||
 | 
					    (@dir/"bar/baz").mkpath
 | 
				
			||||||
 | 
					    cmd1 = @dir/"foo"
 | 
				
			||||||
 | 
					    cmd2 = @dir/"bar/foo"
 | 
				
			||||||
 | 
					    cmd3 = @dir/"bar/baz/foo"
 | 
				
			||||||
 | 
					    FileUtils.touch cmd2
 | 
				
			||||||
 | 
					    [cmd1, cmd3].each do |cmd|
 | 
				
			||||||
 | 
					      FileUtils.touch cmd
 | 
				
			||||||
 | 
					      cmd.chmod 0744
 | 
				
			||||||
 | 
					    end
 | 
				
			||||||
 | 
					    assert_equal [cmd3, cmd1],
 | 
				
			||||||
 | 
					      which_all("foo", "#{@dir}/bar/baz:#{@dir}/baz:#{@dir}:~baduserpath")
 | 
				
			||||||
 | 
					  end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  def test_popen_read
 | 
					  def test_popen_read
 | 
				
			||||||
    out = Utils.popen_read("/bin/sh", "-c", "echo success").chomp
 | 
					    out = Utils.popen_read("/bin/sh", "-c", "echo success").chomp
 | 
				
			||||||
    assert_equal "success", out
 | 
					    assert_equal "success", out
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user