diff options
author | James Booth <boothj5@gmail.com> | 2014-01-23 22:38:12 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-01-23 22:38:12 +0000 |
commit | e089ffb15ca3918b456e05c6198fc0cd122d08a2 (patch) | |
tree | 2512f23ddabfc8c4ff789bffa74898764101da48 /tests | |
parent | 8dbe300d72e3bdaba672b4a7027ab0f2fb431862 (diff) | |
download | profani-tty-e089ffb15ca3918b456e05c6198fc0cd122d08a2.tar.gz |
Show message when alias already exists in /alias add
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_cmd_alias.c | 16 | ||||
-rw-r--r-- | tests/test_cmd_alias.h | 1 | ||||
-rw-r--r-- | tests/testsuite.c | 3 |
3 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_cmd_alias.c b/tests/test_cmd_alias.c index bdb16ede..b337b49a 100644 --- a/tests/test_cmd_alias.c +++ b/tests/test_cmd_alias.c @@ -94,6 +94,22 @@ void cmd_alias_add_adds_alias(void **state) free(help); } +void cmd_alias_add_shows_message_when_exists(void **state) +{ + mock_cons_show(); + CommandHelp *help = malloc(sizeof(CommandHelp)); + gchar *args[] = { "add", "hc", "/help commands", NULL }; + + prefs_add_alias("hc", "/help commands"); + + expect_cons_show("Command alias /hc already exists."); + + gboolean result = cmd_alias(args, *help); + assert_true(result); + + free(help); +} + void cmd_alias_remove_removes_alias(void **state) { mock_cons_show(); diff --git a/tests/test_cmd_alias.h b/tests/test_cmd_alias.h index 1f2df5cd..bd93ef1a 100644 --- a/tests/test_cmd_alias.h +++ b/tests/test_cmd_alias.h @@ -3,6 +3,7 @@ void cmd_alias_add_shows_usage_when_no_value(void **state); void cmd_alias_remove_shows_usage_when_no_args(void **state); void cmd_alias_show_usage_when_invalid_subcmd(void **state); void cmd_alias_add_adds_alias(void **state); +void cmd_alias_add_shows_message_when_exists(void **state); void cmd_alias_remove_removes_alias(void **state); void cmd_alias_remove_shows_message_when_no_alias(void **state); void cmd_alias_list_shows_all_aliases(void **state); diff --git a/tests/testsuite.c b/tests/testsuite.c index af42fe7c..1e847716 100644 --- a/tests/testsuite.c +++ b/tests/testsuite.c @@ -399,6 +399,9 @@ int main(int argc, char* argv[]) { unit_test_setup_teardown(cmd_alias_add_adds_alias, create_config_file, delete_config_file), + unit_test_setup_teardown(cmd_alias_add_shows_message_when_exists, + create_config_file, + delete_config_file), unit_test_setup_teardown(cmd_alias_remove_removes_alias, create_config_file, delete_config_file), |