Skip to content

Commit

Permalink
Test stacktrace
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed Oct 28, 2024
1 parent 2bcabac commit 1a3435b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions nano/core_test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ add_executable(
request_aggregator.cpp
signal_manager.cpp
socket.cpp
stacktrace.cpp
system.cpp
telemetry.cpp
throttle.cpp
Expand Down
13 changes: 13 additions & 0 deletions nano/core_test/stacktrace.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <nano/lib/stacktrace.hpp>

#include <gtest/gtest.h>

// Check that the stacktrace contains the current function name
// This depends on the way testcase names are compiled by gtest
// Current name: "stacktrace_human_readable_Test::TestBody()"
TEST (stacktrace, human_readable)
{
auto stacktrace = nano::generate_stacktrace ();
ASSERT_FALSE (stacktrace.empty ());
ASSERT_TRUE (stacktrace.find ("stacktrace_human_readable_Test") != std::string::npos);
}

0 comments on commit 1a3435b

Please sign in to comment.