formula_assertions: print output on assertion failed.

When doing `brew test --verbose` (as `brew test-bot` does) ensure that
the output is printed when an assertion fails to more easily debug the
test failure.
This commit is contained in:
Mike McQuaid 2020-03-10 09:21:30 +00:00
parent e4d520e840
commit 115aafb9eb
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70

View File

@ -11,6 +11,9 @@ module Homebrew
output = `#{cmd}` output = `#{cmd}`
assert_equal result, $CHILD_STATUS.exitstatus assert_equal result, $CHILD_STATUS.exitstatus
output output
rescue Test::Unit::AssertionFailedError
puts output if Homebrew.args.verbose?
raise
end end
# Returns the output of running the cmd with the optional input, and # Returns the output of running the cmd with the optional input, and
@ -24,6 +27,9 @@ module Homebrew
end end
assert_equal result, $CHILD_STATUS.exitstatus unless result.nil? assert_equal result, $CHILD_STATUS.exitstatus unless result.nil?
output output
rescue Test::Unit::AssertionFailedError
puts output if Homebrew.args.verbose?
raise
end end
end end
end end