aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2009-11-18 15:50:01 -0800
committerAdam Vandenberg2009-11-18 15:50:01 -0800
commit83fc432eab54b12e93a62fa1800bced66c631aec (patch)
tree10ffba903693e853578bfe486dff04332aaf38d9 /Library
parent6e7731aeff1195a55a88ce88dc44d0ac870f31aa (diff)
downloadbrew-83fc432eab54b12e93a62fa1800bced66c631aec.tar.bz2
Refactor formula_test.
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/Homebrew/test/formula_test.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/Library/Homebrew/test/formula_test.rb b/Library/Homebrew/test/formula_test.rb
index c9033390a..50c487a6d 100755
--- a/Library/Homebrew/test/formula_test.rb
+++ b/Library/Homebrew/test/formula_test.rb
@@ -40,8 +40,13 @@ class FormulaNames <Test::Unit::TestCase
end
class WellKnownCodeIssues <Test::Unit::TestCase
+ def all_formulas
+ Dir["#{HOMEBREW_PREFIX}/Library/Formula/*.rb"].each {|f| yield f }
+ end
+
def test_for_commented_out_cmake
- Dir["#{HOMEBREW_PREFIX}/Library/Formula/*.rb"].each do |f|
+ # Formulas shouldn't contain commented-out cmake code from the default template
+ all_formulas do |f|
result = `grep "# depends_on 'cmake'" "#{f}"`.strip
assert_equal('', result, "Commented template code still in #{f}")
end
@@ -51,7 +56,7 @@ class WellKnownCodeIssues <Test::Unit::TestCase
# Prefix should not have single quotes if the system args are already separated
target_string = "[\\\"]--prefix=[\\']"
- Dir["#{HOMEBREW_PREFIX}/Library/Formula/*.rb"].each do |f|
+ all_formulas do |f|
result = `grep -e "#{target_string}" "#{f}"`.strip
assert_equal('', result, "--prefix is incorrectly single-quoted in #{f}")
end