about summary refs log tree commit diff stats
path: root/tests
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
parent8dbe300d72e3bdaba672b4a7027ab0f2fb431862 (diff)
downloadprofani-tty-e089ffb15ca3918b456e05c6198fc0cd122d08a2.tar.gz
Show message when alias already exists in /alias add
Diffstat (limited to 'tests')
-rw-r--r--tests/test_cmd_alias.c16
-rw-r--r--tests/test_cmd_alias.h1
-rw-r--r--tests/testsuite.c3
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),
i-tty/commit/stabbertests/test_connect.c?id=5aab876ab547b1e8d534eab022cf17139415bf9d'>5aab876a ^
7f98e013 ^
a28f0d9e ^
e2fa67fa ^
79ecff1c ^

7fb00a1e ^
db9376d8 ^


a48b9fce ^
db9376d8 ^
5aab876a ^
7f98e013 ^


db9376d8 ^







6640a089 ^
a48b9fce ^
db9376d8 ^
a522d022 ^
db9376d8 ^

37600846 ^
f17afcf5 ^
37600846 ^
a48b9fce ^
37600846 ^
a48b9fce ^
7f98e013 ^
37600846 ^


a48b9fce ^



7f98e013 ^
37600846 ^


a48b9fce ^



7f98e013 ^
37600846 ^



a522d022 ^
f8c5ed57 ^

7f98e013 ^
f8c5ed57 ^



a522d022 ^
37600846 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95