diff options
Diffstat (limited to 'src/assert.hh')
| -rw-r--r-- | src/assert.hh | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/assert.hh b/src/assert.hh index 3d807ea6..ff642c9a 100644 --- a/src/assert.hh +++ b/src/assert.hh @@ -22,8 +22,16 @@ void on_assert_failed(const char* message); on_assert_failed("assert failed \"" #__VA_ARGS__ \ "\" at " __FILE__ ":" TOSTRING(__LINE__)); \ } while (false) + + #define kak_expect_throw(exception_type, ...) try {\ + __VA_ARGS__; \ + on_assert_failed("expression \"" #__VA_ARGS__ \ + "\" did not throw \"" #exception_type \ + "\" at " __FILE__ ":" TOSTRING(__LINE__)); \ + } catch (exception_type &err) {} #else #define kak_assert(...) do { (void)sizeof(__VA_ARGS__); } while(false) + #define kak_expect_throw(_, ...) do { (void)sizeof(__VA_ARGS__); } while(false) #endif |
