about summary refs log tree commit diff stats
path: root/tests/test_cmd_alias.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-01-23 22:38:12 +0000
committerJames Booth <boothj5@gmail.com>2014-01-23 22:38:12 +0000
commite089ffb15ca3918b456e05c6198fc0cd122d08a2 (patch)
tree2512f23ddabfc8c4ff789bffa74898764101da48 /tests/test_cmd_alias.c
parent8dbe300d72e3bdaba672b4a7027ab0f2fb431862 (diff)
downloadprofani-tty-e089ffb15ca3918b456e05c6198fc0cd122d08a2.tar.gz
Show message when alias already exists in /alias add
Diffstat (limited to 'tests/test_cmd_alias.c')
-rw-r--r--tests/test_cmd_alias.c16
1 files changed, 16 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();