From f3a5a83452494c11bf6ff58db1b983172c76fc7f Mon Sep 17 00:00:00 2001
From: Mike McQuaid <mike@mikemcquaid.com>
Date: Sat, 27 Dec 2014 15:58:29 +0000
Subject: [PATCH] audit (strict): check a test is present.

---
 Library/Homebrew/cmd/audit.rb | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb
index 69efcaf832..8c76d92a75 100644
--- a/Library/Homebrew/cmd/audit.rb
+++ b/Library/Homebrew/cmd/audit.rb
@@ -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
-- 
GitLab