From 50e422659bb1533da2d5f04bbd17de062dcad84b Mon Sep 17 00:00:00 2001 From: Tim Allen Date: Thu, 15 Mar 2018 23:02:27 +1100 Subject: Add support for the shift modifier. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Because keyboard layouts vary, the shift-modifier `` is only supported for special keys (like `` and ``) and for ASCII lowercase where we assume the shift-modifier just produces the matching uppercase character. Even that's not universally true, since in Turkish `i` and `I` are not an uppercase/lowercase pair, but Kakoune's default keyboard mappings already assume en-US mappings for mnemonic purposes. Mappings of the form `` are normalized to `` when `x` is an ASCII character. `` is removed, since we can now say ``. --- src/assert.hh | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/assert.hh') 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 -- cgit v1.2.3