diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index d76df00..d9b1af4 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -3,6 +3,7 @@ SET(CLI_TESTS test_pointrect test_rwops test_optional + test_error ) # tests which test graphics functionality and thus requre working diff --git a/tests/test_error.cc b/tests/test_error.cc new file mode 100644 index 0000000..46d9dd5 --- /dev/null +++ b/tests/test_error.cc @@ -0,0 +1,18 @@ +#include + +#include + +#include "testing.h" + +using namespace SDL2pp; + +BEGIN_TEST() + SDL_SetError("foo"); + + try { + throw Exception(""); + } catch (SDL2pp::Exception& e) { + SDL_SetError("bar"); + EXPECT_EQUAL((std::string)e.GetSDLError(), "foo"); + } +END_TEST()