Show message when alias already exists in /alias add
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user