Merge pull request #2841 from mistydemeo/formula_assertions_constant

Define a custom assertion failure error for cross-version compat
This commit is contained in:
Mike McQuaid 2017-07-07 10:14:21 +01:00 committed by GitHub
commit ddb1fd7981
2 changed files with 6 additions and 1 deletions

View File

@ -83,7 +83,7 @@ module Homebrew
exec(*args)
end
end
rescue MiniTest::Assertion => e
rescue ::Test::Unit::AssertionFailedError => e
ofail "#{f.full_name}: failed"
puts e.message
rescue Exception => e

View File

@ -3,6 +3,11 @@ module Homebrew
require "test/unit/assertions"
include ::Test::Unit::Assertions
# TODO: remove this when we no longer support Ruby 2.0.
unless defined?(Test::Unit::AssertionFailedError)
Test::Unit::AssertionFailedError = MiniTest::Assertion
end
# Returns the output of running cmd, and asserts the exit status
def shell_output(cmd, result = 0)
ohai cmd