macros: add UNITTEST macro and use to replace test_keymap_lookup()

This commit is contained in:
Craig Barnes 2021-05-25 18:38:16 +01:00 committed by Daniel Eklöf
parent 360946917c
commit 3d9302b6f9
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 17 additions and 4 deletions

View file

@ -884,9 +884,7 @@ keymap_lookup(struct terminal *term, xkb_keysym_t sym, enum modifier mods)
return NULL;
}
#if defined(_DEBUG)
static void __attribute__((constructor))
test_keymap_lookup(void)
UNITTEST
{
struct terminal term = {
.num_lock_modifier = false,
@ -897,7 +895,6 @@ test_keymap_lookup(void)
const struct key_data *info = keymap_lookup(&term, XKB_KEY_ISO_Left_Tab, MOD_SHIFT | MOD_CTRL);
xassert(strcmp(info->seq, "\033[27;6;9~") == 0);
}
#endif
static void
key_press_release(struct seat *seat, struct terminal *term, uint32_t serial,