diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f334287..5756831 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,7 +1,6 @@ # simple command-line tests SET(CLI_TESTS test_color_constexpr - test_error test_optional test_pointrect test_pointrect_constexpr @@ -63,6 +62,7 @@ ENDFOREACH(TEST ${TESTS}) # Catch based tests SET(CATCH_CLI_TESTS test_color + test_error ) ADD_EXECUTABLE(unit_tests_catch catch_main.cc ${CATCH_CLI_TESTS}) diff --git a/tests/test_error.cc b/tests/test_error.cc index 471a4bc..34a48f8 100644 --- a/tests/test_error.cc +++ b/tests/test_error.cc @@ -1,13 +1,16 @@ -#include +#include "catch.hpp" + #include #include -#include "testing.h" - using namespace SDL2pp; -BEGIN_TEST(int, char*[]) +using Catch::Equals; + +auto const TAGS = "[general][error]"; + +TEST_CASE("Test throwing Exception class", TAGS) { SDL_SetError("BarError"); try { @@ -15,8 +18,8 @@ BEGIN_TEST(int, char*[]) } catch (SDL2pp::Exception& e) { // this SDL_SetError should not clobber Exception contents SDL_SetError("AnotherError"); - EXPECT_EQUAL(e.GetSDLFunction(), "FooFunction"); - EXPECT_EQUAL(e.GetSDLError(), "BarError"); - EXPECT_EQUAL((std::string)e.what(), "FooFunction failed: BarError"); + CHECK_THAT(e.GetSDLFunction(), Equals("FooFunction")); + CHECK_THAT(e.GetSDLError(), Equals("BarError")); + CHECK_THAT(e.what(), Equals("FooFunction failed: BarError")); } -END_TEST() +}