Add testcases for backtrace
This commit is contained in:
parent
1126d7bd10
commit
3563f4687d
@ -10,6 +10,8 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include "../logging/logging.h"
|
#include "../logging/logging.h"
|
||||||
|
|
||||||
|
// TODO Add file and line number on non-windows
|
||||||
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::ostringstream;
|
using std::ostringstream;
|
||||||
using namespace cpputils::logging;
|
using namespace cpputils::logging;
|
||||||
|
@ -42,6 +42,7 @@ set(SOURCES
|
|||||||
logging/LoggerIncludeTest.cpp
|
logging/LoggerIncludeTest.cpp
|
||||||
logging/LoggingIncludeTest.cpp
|
logging/LoggingIncludeTest.cpp
|
||||||
assert/assert_release_test.cpp
|
assert/assert_release_test.cpp
|
||||||
|
assert/backtrace_test.cpp
|
||||||
assert/backtrace_include_test.cpp
|
assert/backtrace_include_test.cpp
|
||||||
assert/assert_include_test.cpp
|
assert/assert_include_test.cpp
|
||||||
assert/assert_debug_test.cpp
|
assert/assert_debug_test.cpp
|
||||||
|
16
test/cpp-utils/assert/backtrace_test.cpp
Normal file
16
test/cpp-utils/assert/backtrace_test.cpp
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
#include <gmock/gmock.h>
|
||||||
|
#include "cpp-utils/assert/backtrace.h"
|
||||||
|
|
||||||
|
using std::string;
|
||||||
|
using testing::HasSubstr;
|
||||||
|
|
||||||
|
TEST(BacktraceTest, ContainsExecutableName) {
|
||||||
|
string backtrace = cpputils::backtrace();
|
||||||
|
EXPECT_THAT(backtrace, HasSubstr("cpp-utils-test"));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(BacktraceTest, ContainsTopLevelLine) {
|
||||||
|
string backtrace = cpputils::backtrace();
|
||||||
|
EXPECT_THAT(backtrace, HasSubstr("BacktraceTest"));
|
||||||
|
EXPECT_THAT(backtrace, HasSubstr("ContainsTopLevelLine"));
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user