2009-09-23 10:35:36 -07:00
|
|
|
#!/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.
|
|
|
|
|
2009-10-23 16:40:55 +01:00
|
|
|
$:.push(File.expand_path(__FILE__+'/../..'))
|
2009-09-23 10:35:36 -07:00
|
|
|
require 'test/unit'
|
|
|
|
require 'global'
|
|
|
|
require 'formula'
|
|
|
|
require 'utils'
|
|
|
|
|
|
|
|
|
2009-11-19 14:10:47 -08:00
|
|
|
class WellKnownCodeIssues <Test::Unit::TestCase
|
2009-09-23 10:35:36 -07:00
|
|
|
def test_formula_names
|
2009-11-19 14:10:47 -08:00
|
|
|
# Formula names should be valid
|
2009-09-23 10:35:36 -07:00
|
|
|
nostdout do
|
|
|
|
Dir["#{HOMEBREW_PREFIX}/Library/Formula/*.rb"].each do |f|
|
|
|
|
assert_nothing_raised do
|
|
|
|
Formula.factory f
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2009-10-07 15:33:25 -07:00
|
|
|
|
|
|
|
def test_for_commented_out_cmake
|
2009-11-18 15:50:01 -08:00
|
|
|
# Formulas shouldn't contain commented-out cmake code from the default template
|
2009-11-19 14:10:47 -08:00
|
|
|
Formulary.paths.each do |f|
|
2009-10-07 15:33:25 -07:00
|
|
|
result = `grep "# depends_on 'cmake'" "#{f}"`.strip
|
|
|
|
assert_equal('', result, "Commented template code still in #{f}")
|
|
|
|
end
|
|
|
|
end
|
2009-11-18 15:43:00 -08:00
|
|
|
|
|
|
|
def test_for_misquoted_prefix
|
|
|
|
# Prefix should not have single quotes if the system args are already separated
|
|
|
|
target_string = "[\\\"]--prefix=[\\']"
|
|
|
|
|
2009-11-19 14:10:47 -08:00
|
|
|
Formulary.paths.each do |f|
|
2009-11-18 15:43:00 -08:00
|
|
|
result = `grep -e "#{target_string}" "#{f}"`.strip
|
|
|
|
assert_equal('', result, "--prefix is incorrectly single-quoted in #{f}")
|
|
|
|
end
|
|
|
|
end
|
2010-02-04 17:29:47 -08:00
|
|
|
|
|
|
|
def test_for_crufy_sourceforge_url
|
|
|
|
# Don't specify mirror for SourceForge downloads
|
|
|
|
Formulary.paths.each do |f|
|
|
|
|
result = `grep "\?use_mirror=" "#{f}"`.strip
|
|
|
|
assert_equal('', result, "Remove 'use_mirror' from url for #{f}")
|
|
|
|
end
|
|
|
|
end
|
2009-11-18 15:43:00 -08:00
|
|
|
end
|