Skip to content

Commit

Permalink
feat: add stacktrace to match report prints
Browse files Browse the repository at this point in the history
  • Loading branch information
DNKpp committed Dec 22, 2024
1 parent ae9ad9a commit b61797e
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions include/mimic++/Reporter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,22 @@ namespace mimicpp

namespace detail
{
template <print_iterator OutIter>
OutIter stringify_stacktrace(OutIter out, const Stacktrace& stacktrace)
{
if (!stacktrace.empty())
{
out = format::format_to(
std::move(out),
"Stacktrace:\n");
out = mimicpp::print(
std::move(out),
stacktrace);
}

return out;
}

[[nodiscard]]
inline StringT stringify_no_match_report(const CallReport& call, const std::span<const MatchReport> matchReports)
{
Expand Down Expand Up @@ -217,6 +233,10 @@ namespace mimicpp
}
}

stringify_stacktrace(
std::ostreambuf_iterator{ss},
call.stacktrace);

return std::move(ss).str();
}

Expand All @@ -239,6 +259,10 @@ namespace mimicpp
ss << "\n";
}

stringify_stacktrace(
std::ostreambuf_iterator{ss},
call.stacktrace);

return std::move(ss).str();
}

Expand All @@ -257,6 +281,10 @@ namespace mimicpp
matchReport);
ss << "\n";

stringify_stacktrace(
std::ostreambuf_iterator{ss},
call.stacktrace);

return std::move(ss).str();
}

Expand Down

0 comments on commit b61797e

Please sign in to comment.