aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/test.rb
blob: ed19fb3030026e3e5e53a60314e73986c9092e2c (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
25
26
module Homebrew extend self
  def test
    raise KegUnspecifiedError if ARGV.named.empty?

    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