test: config: verify setting an empty key/mouse binding fails

This commit is contained in:
Daniel Eklöf 2021-12-18 20:42:37 +01:00
parent c076f03dc4
commit 454d4e22aa
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -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);