diff --git a/tests/test_cmd_account.c b/tests/test_cmd_account.c index 33ba348b..ee4fb673 100644 --- a/tests/test_cmd_account.c +++ b/tests/test_cmd_account.c @@ -53,7 +53,7 @@ void cmd_account_shows_account_when_connected_and_no_args(void **state) void cmd_account_list_shows_accounts(void **state) { CommandHelp *help = malloc(sizeof(CommandHelp)); - gchar *args[] = { "list" }; + gchar *args[] = { "list", NULL }; gchar **accounts = malloc(sizeof(gchar *) * 4); accounts[0] = strdup("account1"); @@ -70,3 +70,17 @@ void cmd_account_list_shows_accounts(void **state) free(help); } + +void cmd_account_show_shows_usage_when_no_arg(void **state) +{ + CommandHelp *help = malloc(sizeof(CommandHelp)); + help->usage = "some usage"; + gchar *args[] = { "show", NULL }; + + expect_string(cons_show, output, "Usage: some usage"); + + gboolean result = cmd_account(args, *help); + assert_true(result); + + free(help); +} diff --git a/tests/test_cmd_account.h b/tests/test_cmd_account.h index 2232b6aa..682c1c4a 100644 --- a/tests/test_cmd_account.h +++ b/tests/test_cmd_account.h @@ -1,3 +1,4 @@ void cmd_account_shows_usage_when_not_connected_and_no_args(void **state); void cmd_account_shows_account_when_connected_and_no_args(void **state); void cmd_account_list_shows_accounts(void **state); +void cmd_account_show_shows_usage_when_no_arg(void **state); diff --git a/tests/testsuite.c b/tests/testsuite.c index f594a35e..3d62f84f 100644 --- a/tests/testsuite.c +++ b/tests/testsuite.c @@ -31,6 +31,7 @@ int main(int argc, char* argv[]) { unit_test(cmd_account_shows_usage_when_not_connected_and_no_args), unit_test(cmd_account_shows_account_when_connected_and_no_args), unit_test(cmd_account_list_shows_accounts), + unit_test(cmd_account_show_shows_usage_when_no_arg), unit_test(cmd_rooms_shows_message_when_disconnected), unit_test(cmd_rooms_shows_message_when_disconnecting),