Make Test::Unit assertions available in formula tests
Closes Homebrew/homebrew#18753. Closes Homebrew/homebrew#20358.
This commit is contained in:
parent
b0fe493ca1
commit
bae36f0830
@ -2,6 +2,7 @@ require 'extend/ENV'
|
||||
require 'hardware'
|
||||
require 'keg'
|
||||
require 'timeout'
|
||||
require 'test/unit/assertions'
|
||||
|
||||
module Homebrew extend self
|
||||
TEST_TIMEOUT_SECONDS = 5*60
|
||||
@ -31,6 +32,9 @@ module Homebrew extend self
|
||||
Timeout::timeout TEST_TIMEOUT_SECONDS do
|
||||
raise if f.test == false
|
||||
end
|
||||
rescue Test::Unit::AssertionFailedError => e
|
||||
ofail "#{f.name}: failed"
|
||||
puts e.message
|
||||
rescue Exception
|
||||
ofail "#{f.name}: failed"
|
||||
end
|
||||
|
||||
@ -562,6 +562,8 @@ class Formula
|
||||
end
|
||||
|
||||
def test
|
||||
require 'test/unit/assertions'
|
||||
extend(Test::Unit::Assertions)
|
||||
ret = nil
|
||||
mktemp do
|
||||
@testpath = Pathname.pwd
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user