Arbutils/tests/ExceptionTests.cpp

18 lines
490 B
C++
Raw Normal View History

#ifdef TESTS_BUILD
#include "../extern/catch.hpp"
#include "../src/Exception.hpp"
using namespace ArbUt;
static void Thrower() { throw ArbUt::Exception("foobar"); }
TEST_CASE("Throw exception get stack trace") {
try {
Thrower();
2020-08-15 12:19:36 +00:00
} catch (const ArbUt::Exception& e) {
2020-08-17 10:05:15 +00:00
REQUIRE(e.GetStacktrace(1) ==
"Stacktrace with depth 1: \n"
"ExceptionTests.cpp[6] static void Thrower() { throw ArbUt::Exception(\"foobar\"); }\n");
}
}
#endif