Improve assertion logging
This commit is contained in:
parent
134298ca77
commit
92ca481915
2 changed files with 5 additions and 4 deletions
|
|
@ -5,11 +5,11 @@
|
|||
TEST (assert_DeathTest, debug_assert)
|
||||
{
|
||||
debug_assert (true);
|
||||
ASSERT_DEATH (debug_assert (false), ".*Assertion \\(false\\) failed.*");
|
||||
ASSERT_DEATH (debug_assert (false, "test"), ".*Assertion `false` failed: test.*");
|
||||
}
|
||||
|
||||
TEST (assert_DeathTest, release_assert)
|
||||
{
|
||||
release_assert (true);
|
||||
ASSERT_DEATH (release_assert (false), ".*Assertion \\(false\\) failed.*");
|
||||
ASSERT_DEATH (release_assert (false, "test"), ".*Assertion `false` failed: test.*");
|
||||
}
|
||||
|
|
@ -14,11 +14,12 @@
|
|||
void assert_internal (char const * check_expr, char const * func, char const * file, unsigned int line, bool is_release_assert, std::string_view error_msg)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "Assertion (" << check_expr << ") failed";
|
||||
ss << "Assertion `" << check_expr << "` failed";
|
||||
if (!error_msg.empty ())
|
||||
{
|
||||
ss << ": " << error_msg << "\n";
|
||||
ss << ": " << error_msg;
|
||||
}
|
||||
ss << "\n";
|
||||
ss << file << ":" << line << " [" << func << "]"
|
||||
<< "'\n";
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue