aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/formula.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/formula.rb')
-rw-r--r--Library/Homebrew/formula.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index 740577ba7..2a9e4e704 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -26,6 +26,7 @@ class Formula
set_instance_variable :bottle
set_instance_variable :devel
set_instance_variable :head
+ set_instance_variable :test
@name = name
validate_variable :name
@@ -590,12 +591,16 @@ public
ret = nil
mktemp do
@testpath = Pathname.pwd
- ret = instance_eval(&self.class.test)
+ ret = instance_eval(&@test)
@testpath = nil
end
ret
end
+ def test_defined?
+ not @test.nil?
+ end
+
private
def stage
@@ -642,7 +647,12 @@ private
end
def self.method_added method
- raise 'You cannot override Formula.brew' if method == :brew
+ case method
+ when :brew
+ raise "You cannot override Formula#brew"
+ when :test
+ @test = method
+ end
end
class << self