18 lines
460 B
C++
18 lines
460 B
C++
#ifdef TESTS_BUILD
|
|
#include <cstring>
|
|
#include "../extern/catch.hpp"
|
|
#include "../src/Core/Exceptions/CreatureException.hpp"
|
|
|
|
TEST_CASE("When throwing exception, what() is readable", "[Utilities]") {
|
|
bool hasCaught = false;
|
|
try {
|
|
throw CreatureException("foobar");
|
|
} catch (const std::exception& e) {
|
|
hasCaught = true;
|
|
INFO(e.what());
|
|
REQUIRE(strcmp(e.what(), "foobar") == 0);
|
|
}
|
|
REQUIRE(hasCaught);
|
|
}
|
|
|
|
#endif |