Arbutils/tests/ExceptionTests.cpp

21 lines
540 B
C++

#ifdef TESTS_BUILD
#include "../extern/catch.hpp"
#include "../src/Exception.hpp"
using namespace ArbUt;
TEST_CASE("Throw exception get stack trace") {
try {
throw ArbUt::Exception("foobar");
}
catch (const ArbUt::Exception& e) {
#ifndef NDEBUG
REQUIRE(e.GetStacktrace(1) ==
"ExceptionTests.cpp[8] ____C_A_T_C_H____T_E_S_T____0()\n");
#else
REQUIRE(e.GetStacktrace(1, false) ==
"ArbutilsTests Catch::RunContext::runTest(Catch::TestCase const&)\n");
#endif
}
}
#endif