aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/test.rb
diff options
context:
space:
mode:
authorAdam Vandenberg2011-03-10 21:28:49 -0800
committerAdam Vandenberg2011-03-12 11:55:10 -0800
commitbda9ffa5d7fd08011da9d82e24252478c8681544 (patch)
treeab660cacbae012b95a460b22e31615289a58c0da /Library/Homebrew/cmd/test.rb
parentf0b6f6853a86a102761907ded21c3ceca5be577f (diff)
downloadbrew-bda9ffa5d7fd08011da9d82e24252478c8681544.tar.bz2
'brew test' now an official command
Diffstat (limited to 'Library/Homebrew/cmd/test.rb')
-rw-r--r--Library/Homebrew/cmd/test.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/test.rb b/Library/Homebrew/cmd/test.rb
new file mode 100644
index 000000000..7f828d948
--- /dev/null
+++ b/Library/Homebrew/cmd/test.rb
@@ -0,0 +1,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