2020-08-15 11:31:16 +00:00
|
|
|
#ifdef TESTS_BUILD
|
|
|
|
#include "../extern/catch.hpp"
|
|
|
|
#include "../src/Exception.hpp"
|
|
|
|
using namespace ArbUt;
|
|
|
|
|
2020-08-15 12:05:22 +00:00
|
|
|
TEST_CASE("Throw exception get stack trace") {
|
2020-08-15 11:31:16 +00:00
|
|
|
try {
|
|
|
|
throw ArbUt::Exception("foobar");
|
2020-08-15 12:19:36 +00:00
|
|
|
} catch (const ArbUt::Exception& e) {
|
2020-08-15 11:59:10 +00:00
|
|
|
#ifndef NDEBUG
|
2020-08-15 12:19:36 +00:00
|
|
|
REQUIRE(e.GetStacktrace(1) == "ExceptionTests.cpp[8] ____C_A_T_C_H____T_E_S_T____0()\n");
|
2020-08-15 11:59:10 +00:00
|
|
|
#else
|
2020-08-15 12:19:36 +00:00
|
|
|
REQUIRE(e.GetStacktrace(1, false) == "ArbutilsTests Catch::RunContext::runTest(Catch::TestCase const&)\n");
|
2020-08-15 11:59:10 +00:00
|
|
|
#endif
|
2020-08-15 11:31:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|