mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-23 19:53:28 +01:00
db32550898
There are two reasons for this: 1) It is highly unlikely that someone has use for this header, which has no customization points and only provides simplest possible main, and cannot link the static library which also provides a default main implementation. 2) It being a header was causing extra complications with the convenience headers, and our checking script. This would either require special handling in the checking script, or would break user's of the main convenience header. All in all, it is simpler and better in the long term to remove it, than to fix its problems.
31 lines
806 B
C++
31 lines
806 B
C++
#include <catch2/catch_test_macros.hpp>
|
|
|
|
namespace Catch {
|
|
[[noreturn]]
|
|
void throw_exception(std::exception const& e) {
|
|
Catch::cerr() << "====== CUSTOM HANDLER ====== run terminates because an exception was thrown.\n"
|
|
<< "The message was: " << e.what() << '\n';
|
|
// Avoid abort and other exceptional exits -- there is no way
|
|
// to tell CMake that abort is the desired outcome of a test.
|
|
exit(1);
|
|
}
|
|
}
|
|
|
|
TEST_CASE("Tests that run") {
|
|
// All of these should be run and be reported
|
|
CHECK(1 == 2);
|
|
CHECK(1 == 1);
|
|
CHECK(1 != 3);
|
|
CHECK(1 == 4);
|
|
}
|
|
|
|
|
|
|
|
TEST_CASE("Tests that abort") {
|
|
REQUIRE(1 == 1);
|
|
REQUIRE(1 != 2);
|
|
REQUIRE(1 == 3);
|
|
// We should not get here, because the test above aborts
|
|
REQUIRE(1 != 4);
|
|
}
|