aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Contributions/examples/brew-test.rb
blob: fad657c4d04248b653e58fb5974852dfe323697c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require 'extend/ENV'
ENV.extend(HomebrewEnvExtension)

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