From cf71349c565cb45e64715b709c529284d05bc111 Mon Sep 17 00:00:00 2001 From: heck Date: Wed, 7 Jul 2021 16:06:30 +0200 Subject: [PATCH] Test: PityTest - fix PITYASSERT_THROWS() --- test/pitytest11/src/PityTest.hh | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/test/pitytest11/src/PityTest.hh b/test/pitytest11/src/PityTest.hh index 17dee59..846ec44 100644 --- a/test/pitytest11/src/PityTest.hh +++ b/test/pitytest11/src/PityTest.hh @@ -10,24 +10,23 @@ #include "PityPerspective.hh" #ifndef PITYASSERT - #define PITYASSERT(condition, msg) \ + #define PITYASSERT(condition, msg) \ do { \ if (!(condition)) { \ throw PityAssertException(msg); \ } \ - } while (0) -#endif - -#ifndef PITYASSERT_THROWS - #define PITYASSERT_THROWS(func, msg) \ - do { \ - try { \ - (func); \ - PITYASSERT(false, msg); \ - } catch (const std::exception& e) { \ - } catch (...) { \ - } \ - } while (0) + } while (0); #endif +#define PITYASSERT_THROWS(func, msg) \ + do { \ + try { \ + (func); \ + PITYASSERT(false, msg); \ + } catch (const PityAssertException& pae) { \ + throw(pae); \ + } catch (const std::exception& e) { \ + } catch (...) { \ + } \ + } while (0); #endif \ No newline at end of file