From bf0870afe4a73521262a5363409d4f8bbf471c62 Mon Sep 17 00:00:00 2001 From: James Booth Date: Sun, 15 Dec 2013 23:30:09 +0000 Subject: [PATCH] Test "/account add" with missing arg --- tests/test_cmd_account.c | 14 ++++++++++++++ tests/test_cmd_account.h | 1 + tests/testsuite.c | 1 + 3 files changed, 16 insertions(+) diff --git a/tests/test_cmd_account.c b/tests/test_cmd_account.c index 1a14159d..842ad13f 100644 --- a/tests/test_cmd_account.c +++ b/tests/test_cmd_account.c @@ -120,3 +120,17 @@ void cmd_account_show_shows_message_when_account_exists(void **state) free(help); } + +void cmd_account_add_shows_usage_when_no_arg(void **state) +{ + CommandHelp *help = malloc(sizeof(CommandHelp)); + help->usage = "some usage"; + gchar *args[] = { "add", 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 4109d807..9b7a4f4b 100644 --- a/tests/test_cmd_account.h +++ b/tests/test_cmd_account.h @@ -4,3 +4,4 @@ void cmd_account_list_shows_accounts(void **state); void cmd_account_show_shows_usage_when_no_arg(void **state); void cmd_account_show_shows_message_when_account_does_not_exist(void **state); void cmd_account_show_shows_message_when_account_exists(void **state); +void cmd_account_add_shows_usage_when_no_arg(void **state); diff --git a/tests/testsuite.c b/tests/testsuite.c index 404fa1a4..2c6789be 100644 --- a/tests/testsuite.c +++ b/tests/testsuite.c @@ -34,6 +34,7 @@ int main(int argc, char* argv[]) { unit_test(cmd_account_show_shows_usage_when_no_arg), unit_test(cmd_account_show_shows_message_when_account_does_not_exist), unit_test(cmd_account_show_shows_message_when_account_exists), + unit_test(cmd_account_add_shows_usage_when_no_arg), unit_test(cmd_rooms_shows_message_when_disconnected), unit_test(cmd_rooms_shows_message_when_disconnecting),