aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/formula_test.rb
diff options
context:
space:
mode:
authorMax Howell2009-10-15 12:36:09 +0100
committerMax Howell2009-10-15 16:51:53 +0100
commit543a113712635b64bcfe0804acea0d8079b8bd44 (patch)
tree404789c8e1a0d62d5e72d0e3c763018c73d51762 /Library/Homebrew/test/formula_test.rb
parent6ad2907000d927e055cacf389228ebdc01fcc0d7 (diff)
downloadbrew-543a113712635b64bcfe0804acea0d8079b8bd44.tar.bz2
Some subdirs and renames to aid homebrew n00bs
The classes better reflect their contents. I'm sure this change may be contentious, but I am a sucker for trying to create source bases that are easy to get to grips with and easy to navigate. brewkit.rb is now a deprecated file.
Diffstat (limited to 'Library/Homebrew/test/formula_test.rb')
-rwxr-xr-xLibrary/Homebrew/test/formula_test.rb49
1 files changed, 49 insertions, 0 deletions
diff --git a/Library/Homebrew/test/formula_test.rb b/Library/Homebrew/test/formula_test.rb
new file mode 100755
index 000000000..15cafae13
--- /dev/null
+++ b/Library/Homebrew/test/formula_test.rb
@@ -0,0 +1,49 @@
+#!/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 'formula'
+require 'utils'
+
+
+# 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
+
+class CommentedTemplateCode <Test::Unit::TestCase
+ def test_for_commented_out_cmake
+ Dir["#{HOMEBREW_PREFIX}/Library/Formula/*.rb"].each do |f|
+ result = `grep "# depends_on 'cmake'" "#{f}"`.strip
+ assert_equal('', result, "Commented template code still in #{f}")
+ end
+ end
+end \ No newline at end of file