Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#ifdef TESTS_BUILD
|
||||
#include <cstring>
|
||||
#include "../CInterface/Core.hpp"
|
||||
#include "../extern/catch.hpp"
|
||||
#include "../src/Library/Exceptions/CreatureException.hpp"
|
||||
|
||||
@@ -10,9 +11,16 @@ TEST_CASE("When throwing exception, what() is readable", "[Utilities]") {
|
||||
} catch (const ArbUt::Exception& e) {
|
||||
hasCaught = true;
|
||||
INFO(e.what());
|
||||
REQUIRE(std::string(e.what()) == "[ExceptionTests.cpp:9] foobar");
|
||||
REQUIRE(std::string(e.what()) == "[ExceptionTests.cpp:10] foobar");
|
||||
}
|
||||
REQUIRE(hasCaught);
|
||||
}
|
||||
|
||||
TEST_CASE("C Interface exception", "[Utilities]") {
|
||||
ExceptionHandler::SetLastArbUtException("foo", ArbUt::Exception("foobar"), 1);
|
||||
REQUIRE(std::string(ExceptionHandler::GetLastException()) == "[foo] foobar");
|
||||
REQUIRE(std::string(ExceptionHandler::GetLastExceptionStacktrace()) ==
|
||||
"ExceptionTests.cpp[20] ____C_A_T_C_H____T_E_S_T____3()\n");
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user