audit (strict): check a test is present.

This commit is contained in:
Mike McQuaid 2014-12-27 15:58:29 +00:00
parent d263c73cc4
commit f3a5a83452

View File

@ -56,6 +56,10 @@ class FormulaText
def has_trailing_newline?
/\Z\n/ =~ @text
end
def has_test?
@text.include? "test do"
end
end
class FormulaAuditor
@ -104,6 +108,12 @@ class FormulaAuditor
unless text.has_trailing_newline?
problem "File should end with a newline"
end
if @strict
unless text.has_test?
problem "A `test do` test block should be added"
end
end
end
@@aliases ||= Formula.aliases