aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2022-02-18 17:40:19 +0000
committerDaniel Eklöf <daniel@ekloef.se>2022-02-18 17:40:19 +0000
commitf76c9e77f1bd2c2c844a703542e939bfb0e77512 (patch)
tree96d6ab4a1c0aa744d78728605e037038f6646acb /tests
parentmain: --server: don’t exit with code 0 on failure (diff)
parentdoc: foot.ini: document the new [text-bindings] section (diff)
Merge branch 'custom-input-escapes'
Closes #325
Diffstat (limited to 'tests')
-rw-r--r--tests/test-config.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/test-config.c b/tests/test-config.c
index 04149a59..eb99780d 100644
--- a/tests/test-config.c
+++ b/tests/test-config.c
@@ -1095,6 +1095,42 @@ test_section_mouse_bindings_collisions(void)
}
static void
+test_section_text_bindings(void)
+{
+ struct config conf = {0};
+ struct context ctx = {
+ .conf = &conf, .section = "text-bindings", .path = "unittest"};
+
+ ctx.key = "abcd";
+ ctx.value = XKB_MOD_NAME_CTRL "+" XKB_MOD_NAME_SHIFT "+x";
+ xassert(parse_section_text_bindings(&ctx));
+
+ ctx.key = "\\x07";
+ xassert(parse_section_text_bindings(&ctx));
+
+ ctx.key = "\\x1g";
+ xassert(!parse_section_text_bindings(&ctx));
+
+ ctx.key = "\\x1";
+ xassert(!parse_section_text_bindings(&ctx));
+
+ ctx.key = "\\x";
+ xassert(!parse_section_text_bindings(&ctx));
+
+ ctx.key = "\\";
+ xassert(!parse_section_text_bindings(&ctx));
+
+ ctx.key = "\\y";
+ xassert(!parse_section_text_bindings(&ctx));
+
+ ctx.key = "abcd";
+ ctx.value = "InvalidMod+y";
+ xassert(!parse_section_text_bindings(&ctx));
+
+ config_free(conf);
+}
+
+static void
test_section_tweak(void)
{
struct config conf = {0};
@@ -1188,6 +1224,7 @@ main(int argc, const char *const *argv)
test_section_url_bindings_collisions();
test_section_mouse_bindings();
test_section_mouse_bindings_collisions();
+ test_section_text_bindings();
test_section_tweak();
log_deinit();
return 0;