aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-12-18 19:42:37 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-12-18 19:42:37 +0000
commit454d4e22aaab3a7d4be3c1fe2f291630a952b1a0 (patch)
tree74aebf1d1e20f5afeb91258e6d7b65ecd25afd46
parentconfig: error out on empty key- or mouse binding (diff)
test: config: verify setting an empty key/mouse binding fails
-rw-r--r--tests/test-config.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/tests/test-config.c b/tests/test-config.c
index 1e99b3c4..6a2edcb8 100644
--- a/tests/test-config.c
+++ b/tests/test-config.c
@@ -296,7 +296,16 @@ test_key_binding(struct context *ctx, bool (*parse_fun)(struct context *ctx),
const int click_count = action % 3 + 1;
/* Finally, generate the ‘value’ (e.g. “Control+shift+x”) */
- char value[128];
+ char value[128] = {0};
+
+ ctx->key = key;
+ ctx->value = value;
+
+ /* First, try setting the empty string */
+ if (parse_fun(ctx)) {
+ BUG("[%s].%s=<empty>: did not fail to parse as expected",
+ ctx->section, ctx->key);
+ }
switch (type) {
case KEY_BINDING: {
@@ -319,9 +328,6 @@ test_key_binding(struct context *ctx, bool (*parse_fun)(struct context *ctx),
}
}
- ctx->key = key;
- ctx->value = value;
-
if (!parse_fun(ctx)) {
BUG("[%s].%s=%s failed to parse",
ctx->section, ctx->key, ctx->value);