From c92125053e360e8bdf95458d185bee7065102f55 Mon Sep 17 00:00:00 2001 From: Dmitry Marakasov Date: Mon, 18 Jan 2016 23:19:47 +0300 Subject: [PATCH] Extend Exception test coverage --- tests/test_error.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/test_error.cc b/tests/test_error.cc index 34728cf..d6f14fb 100644 --- a/tests/test_error.cc +++ b/tests/test_error.cc @@ -8,12 +8,15 @@ using namespace SDL2pp; BEGIN_TEST(int, char*[]) - SDL_SetError("foo"); + SDL_SetError("BarError"); try { - throw Exception(""); + throw Exception("FooFunction"); } catch (SDL2pp::Exception& e) { - SDL_SetError("bar"); - EXPECT_EQUAL((std::string)e.GetSDLError(), "foo"); + // 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()