summaryrefslogtreecommitdiff
path: root/test/command.c
diff options
context:
space:
mode:
authorAlbert Cervin <albert@acervin.com>2023-02-11 23:03:39 +0100
committerAlbert Cervin <albert@acervin.com>2023-02-15 23:41:35 +0100
commite45499816eab8abadbdd5bb6dd79b526a4ed6648 (patch)
tree3cdcb0238aaae8ed1b3578e4ad71883f0702de3c /test/command.c
parentc2976cea9bbca465712534b7e523783e2ccc6c6e (diff)
downloaddged-e45499816eab8abadbdd5bb6dd79b526a4ed6648.tar.gz
dged-e45499816eab8abadbdd5bb6dd79b526a4ed6648.tar.xz
dged-e45499816eab8abadbdd5bb6dd79b526a4ed6648.zip
Implement undo
This also fixes a bunch of valgrind errors
Diffstat (limited to 'test/command.c')
-rw-r--r--test/command.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/command.c b/test/command.c
index be5fffc..09de7f4 100644
--- a/test/command.c
+++ b/test/command.c
@@ -53,6 +53,8 @@ void test_register_command() {
"Expected number of commands to be 3 after inserting two more");
ASSERT(cmds.capacity > 1,
"Expected capacity to have increased to accommodate new commands");
+
+ command_registry_destroy(&cmds);
}
void test_lookup_command() {
@@ -70,6 +72,8 @@ void test_lookup_command() {
"Expected to be able to look up inserted command by hash");
ASSERT_STR_EQ(cmd->name, "fake",
"Expected the found function to have the correct name");
+
+ command_registry_destroy(&cmds);
}
int32_t failing_command(struct command_ctx ctx, int argc, const char *argv[]) {
@@ -91,6 +95,8 @@ void test_execute_command() {
struct command *fail_cmd = lookup_command(&cmds, "fejl");
int32_t res2 = execute_command(fail_cmd, &cmds, NULL, NULL, 0, NULL);
ASSERT(res2 != 0, "Expected failing command to fail");
+
+ command_registry_destroy(&cmds);
}
void run_command_tests() {