aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2009-09-23 10:35:36 -0700
committerMax Howell2009-09-25 19:21:03 +0100
commit260cda6554448ef9c618455b0e1ad6d6d4ab308c (patch)
tree2f5885e8d2b0924af29a458e9695ece25164370f /Library
parent5bd5a126c0f639b0a06d16e5733f6ca171d62292 (diff)
downloadhomebrew-260cda6554448ef9c618455b0e1ad6d6d4ab308c.tar.bz2
Add test for matching formula filename/class.
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/Homebrew/formula_test.rb43
1 files changed, 43 insertions, 0 deletions
diff --git a/Library/Homebrew/formula_test.rb b/Library/Homebrew/formula_test.rb
new file mode 100755
index 000000000..d61fa113e
--- /dev/null
+++ b/Library/Homebrew/formula_test.rb
@@ -0,0 +1,43 @@
+#!/usr/bin/ruby
+# This software is in the public domain, furnished "as is", without technical
+# support, and with no warranty, express or implied, as to its usefulness for
+# any purpose.
+
+$:.unshift File.dirname(__FILE__)
+require 'test/unit'
+require 'global'
+require 'pathname+yeast'
+require 'formula'
+require 'utils'
+
+require 'ARGV+yeast' # needs to be after test/unit to avoid conflict with OptionsParser
+
+
+# NOTE duplicated in unittest.rb (we need to refactor the tests anyway)
+def nostdout
+ if ARGV.include? '-V'
+ yield
+ end
+ begin
+ require 'stringio'
+ tmpo=$stdout
+ tmpe=$stderr
+ $stdout=StringIO.new
+ yield
+ ensure
+ $stdout=tmpo
+ end
+end
+
+
+class FormulaNames <Test::Unit::TestCase
+ def test_formula_names
+ nostdout do
+ Dir["#{HOMEBREW_PREFIX}/Library/Formula/*.rb"].each do |f|
+ assert_nothing_raised do
+ Formula.factory f
+ end
+ end
+ end
+ end
+end