diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2022-02-09 16:52:37 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2022-02-09 16:52:37 +0000 |
| commit | ee840a308aeb3a5ce00137da35dacebe2d9892ad (patch) | |
| tree | 7b100acca663f7ff28f7c431e8c755610957000f /tests | |
| parent | foot.ini: add modeline so vim uses # comments instead of ; (diff) | |
| parent | config: rename csd.color.close -> quit (diff) | |
Merge branch 'refactor-key-bindings'
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test-config.c | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/tests/test-config.c b/tests/test-config.c index bced6b5c..04149a59 100644 --- a/tests/test-config.c +++ b/tests/test-config.c @@ -665,7 +665,7 @@ test_section_csd(void) test_color(&ctx, &parse_section_csd, "button-maximize-color", true, &conf.csd.color.maximize); test_color(&ctx, &parse_section_csd, "button-close-color", true, - &conf.csd.color.close); + &conf.csd.color.quit); /* TODO: verify the ‘set’ bit is actually set for colors */ /* TODO: font */ @@ -677,7 +677,7 @@ static void test_key_binding(struct context *ctx, bool (*parse_fun)(struct context *ctx), int action, int max_action, const char *const *map, struct config_key_binding_list *bindings, - enum config_key_binding_type type) + enum key_binding_type type) { xassert(map[action] != NULL); xassert(bindings->count == 0); @@ -756,30 +756,30 @@ test_key_binding(struct context *ctx, bool (*parse_fun)(struct context *ctx), &bindings->arr[bindings->count - 1]; if (argv) { - if (binding->pipe.argv.args == NULL) { + if (binding->aux.pipe.args == NULL) { BUG("[%s].%s=%s: pipe argv is NULL", ctx->section, ctx->key, ctx->value); } for (size_t i = 0; i < ALEN(args); i++) { - if (binding->pipe.argv.args[i] == NULL || - strcmp(binding->pipe.argv.args[i], args[i]) != 0) + if (binding->aux.pipe.args[i] == NULL || + strcmp(binding->aux.pipe.args[i], args[i]) != 0) { BUG("[%s].%s=%s: pipe argv not the expected one: " "mismatch of arg #%zu: expected=\"%s\", got=\"%s\"", ctx->section, ctx->key, ctx->value, i, - args[i], binding->pipe.argv.args[i]); + args[i], binding->aux.pipe.args[i]); } } - if (binding->pipe.argv.args[ALEN(args)] != NULL) { + if (binding->aux.pipe.args[ALEN(args)] != NULL) { BUG("[%s].%s=%s: pipe argv not the expected one: " "expected NULL terminator at arg #%zu, got=\"%s\"", ctx->section, ctx->key, ctx->value, - ALEN(args), binding->pipe.argv.args[ALEN(args)]); + ALEN(args), binding->aux.pipe.args[ALEN(args)]); } } else { - if (binding->pipe.argv.args != NULL) { + if (binding->aux.pipe.args != NULL) { BUG("[%s].%s=%s: pipe argv not NULL", ctx->section, ctx->key, ctx->value); } @@ -840,7 +840,7 @@ enum collision_test_mode { static void _test_binding_collisions(struct context *ctx, int max_action, const char *const *map, - enum config_key_binding_type type, + enum key_binding_type type, enum collision_test_mode test_mode) { struct config_key_binding *bindings_array = @@ -889,21 +889,23 @@ _test_binding_collisions(struct context *ctx, case FAIL_DIFFERENT_ARGV: case SUCCED_SAME_ACTION_AND_ARGV: - bindings.arr[0].pipe.master_copy = true; - bindings.arr[0].pipe.argv.args = xcalloc( - 4, sizeof(bindings.arr[0].pipe.argv.args[0])); - bindings.arr[0].pipe.argv.args[0] = xstrdup("/usr/bin/foobar"); - bindings.arr[0].pipe.argv.args[1] = xstrdup("hello"); - bindings.arr[0].pipe.argv.args[2] = xstrdup("world"); + bindings.arr[0].aux.type = BINDING_AUX_PIPE; + bindings.arr[0].aux.master_copy = true; + bindings.arr[0].aux.pipe.args = xcalloc( + 4, sizeof(bindings.arr[0].aux.pipe.args[0])); + bindings.arr[0].aux.pipe.args[0] = xstrdup("/usr/bin/foobar"); + bindings.arr[0].aux.pipe.args[1] = xstrdup("hello"); + bindings.arr[0].aux.pipe.args[2] = xstrdup("world"); - bindings.arr[1].pipe.master_copy = true; - bindings.arr[1].pipe.argv.args = xcalloc( - 4, sizeof(bindings.arr[1].pipe.argv.args[0])); - bindings.arr[1].pipe.argv.args[0] = xstrdup("/usr/bin/foobar"); - bindings.arr[1].pipe.argv.args[1] = xstrdup("hello"); + bindings.arr[1].aux.type = BINDING_AUX_PIPE; + bindings.arr[1].aux.master_copy = true; + bindings.arr[1].aux.pipe.args = xcalloc( + 4, sizeof(bindings.arr[1].aux.pipe.args[0])); + bindings.arr[1].aux.pipe.args[0] = xstrdup("/usr/bin/foobar"); + bindings.arr[1].aux.pipe.args[1] = xstrdup("hello"); if (test_mode == SUCCED_SAME_ACTION_AND_ARGV) - bindings.arr[1].pipe.argv.args[2] = xstrdup("world"); + bindings.arr[1].aux.pipe.args[2] = xstrdup("world"); break; } @@ -937,7 +939,7 @@ _test_binding_collisions(struct context *ctx, static void test_binding_collisions(struct context *ctx, int max_action, const char *const *map, - enum config_key_binding_type type) + enum key_binding_type type) { _test_binding_collisions(ctx, max_action, map, type, FAIL_DIFFERENT_ACTION); _test_binding_collisions(ctx, max_action, map, type, FAIL_DIFFERENT_ARGV); |
