Reworks ensure and throw to not fully depend on macros anymore.
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
using namespace ArbUt;
|
||||
|
||||
static void Thrower() { throw ArbUt::Exception("foobar"); }
|
||||
static void ThrowerWithMacro() { THROW("foobar"); }
|
||||
static void ThrowerWithMacroAndParameters([[maybe_unused]] int i) { THROW("foobar", ' ', i); }
|
||||
|
||||
TEST_CASE("Throw exception get stack trace") {
|
||||
try {
|
||||
@@ -16,4 +18,20 @@ TEST_CASE("Throw exception get stack trace") {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("Throw exception with macro, check message") {
|
||||
try {
|
||||
ThrowerWithMacro();
|
||||
} catch (const ArbUt::Exception& e) {
|
||||
REQUIRE_EQ(std::string(e.what()), "[ExceptionTests.cpp:7] \"foobar\"");
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("Throw exception with macro and parameters, check message") {
|
||||
try {
|
||||
ThrowerWithMacroAndParameters(684);
|
||||
} catch (const ArbUt::Exception& e) {
|
||||
REQUIRE_EQ(std::string(e.what()), "[ExceptionTests.cpp:8] \"foobar 684\"");
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user