aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/test.rb
blob: 7f828d9484a296b80ae4f36ea31648ba659a7702 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
module Homebrew extend self
  def test
    ARGV.formulae.each do |f|
      # Cannot test uninstalled formulae
      unless f.installed?
        puts "#{f.name} not installed"
        next
      end

      # Cannot test formulae without a test method
      unless f.respond_to? :test
        puts "#{f.name} defines no test"
        next
      end

      puts "Testing #{f.name}"
      begin
        f.test
      rescue
        puts "#{f.name}: failed"
      end
    end
  end
end