mirror of
https://github.com/libSDL2pp/libSDL2pp.git
synced 2025-08-03 19:05:59 -04:00

Though these are broken and error prone, as they ignore the possibility of conflicts between SDL, SDL2 and wrappers thereof discarding useful include path prefix (SDL2/), since SDL and satellite libraries follow these it's too hard to stay away. So don't use prefixes for SDL include paths any longer.
23 lines
527 B
C++
23 lines
527 B
C++
#include <SDL_main.h>
|
|
#include <SDL_error.h>
|
|
|
|
#include <SDL2pp/Exception.hh>
|
|
|
|
#include "testing.h"
|
|
|
|
using namespace SDL2pp;
|
|
|
|
BEGIN_TEST(int, char*[])
|
|
SDL_SetError("BarError");
|
|
|
|
try {
|
|
throw Exception("FooFunction");
|
|
} 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");
|
|
}
|
|
END_TEST()
|