This method takes a backtrace and block. It then runs the block and
takes any results generated by the block and replaces their backtrace
with the given backtrace.
This allows 3rd-party tools to write their own custom assertions
and have them abstract the 3rd-party backtraces that any results
would have.
An example usage would be:
def assert_some_custom_behavior(*args)
with_backtrace(caller) do
# asset some things (generate results)
end
end
Note: this does not affect error results. These results need
to have "pure" backtraces to assist in debugging (error result
backtraces are never modified in Assert). This will, however,
affect skip and halt-on-fail results: with_backtrace rescues the
exceptions raised in those scenarios and sets the exception's
backtrace to the given backtrace and then re-raises. This way you
get both the halt behavior of the result and the backtrace abstraction
of with_exception.
@jcredding this should help with your MR custom assertions. I'm going to head over there and test this in MR. Ready for review.
This method takes a backtrace and block. It then runs the block and takes any results generated by the block and replaces their backtrace with the given backtrace.
This allows 3rd-party tools to write their own custom assertions and have them abstract the 3rd-party backtraces that any results would have.
An example usage would be:
Note: this does not affect error results. These results need to have "pure" backtraces to assist in debugging (error result backtraces are never modified in Assert). This will, however, affect skip and halt-on-fail results:
with_backtrace
rescues the exceptions raised in those scenarios and sets the exception's backtrace to the given backtrace and then re-raises. This way you get both the halt behavior of the result and the backtrace abstraction ofwith_exception
.@jcredding this should help with your MR custom assertions. I'm going to head over there and test this in MR. Ready for review.