about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--Makefile.am1
-rw-r--r--tests/test_cmd_alias.c14
-rw-r--r--tests/testsuite.c4
-rw-r--r--tests/ui/stub_ui.c7
4 files changed, 11 insertions, 15 deletions
diff --git a/Makefile.am b/Makefile.am
index 5bfd6bfe..0f20b582 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -67,6 +67,7 @@ tests_sources = \
 	tests/config/stub_accounts.c \
 	tests/helpers.c tests/helpers.h \
 	tests/test_cmd_account.c tests/test_cmd_account.h \
+	tests/test_cmd_alias.c tests/test_cmd_alias.h \
 	tests/test_autocomplete.c tests/test_autocomplete.h \
 	tests/testsuite.c
 
diff --git a/tests/test_cmd_alias.c b/tests/test_cmd_alias.c
index 8666b1aa..10ab7f53 100644
--- a/tests/test_cmd_alias.c
+++ b/tests/test_cmd_alias.c
@@ -7,10 +7,9 @@
 #include <glib.h>
 
 #include "xmpp/xmpp.h"
-#include "xmpp/mock_xmpp.h"
 
 #include "ui/ui.h"
-#include "ui/mock_ui.h"
+#include "ui/stub_ui.h"
 
 #include "config/preferences.h"
 
@@ -19,7 +18,6 @@
 
 void cmd_alias_add_shows_usage_when_no_args(void **state)
 {
-    mock_cons_show();
     CommandHelp *help = malloc(sizeof(CommandHelp));
     help->usage = "some usage";
     gchar *args[] = { "add", NULL };
@@ -34,7 +32,6 @@ void cmd_alias_add_shows_usage_when_no_args(void **state)
 
 void cmd_alias_add_shows_usage_when_no_value(void **state)
 {
-    mock_cons_show();
     CommandHelp *help = malloc(sizeof(CommandHelp));
     help->usage = "some usage";
     gchar *args[] = { "add", "alias", NULL };
@@ -49,7 +46,6 @@ void cmd_alias_add_shows_usage_when_no_value(void **state)
 
 void cmd_alias_remove_shows_usage_when_no_args(void **state)
 {
-    mock_cons_show();
     CommandHelp *help = malloc(sizeof(CommandHelp));
     help->usage = "some usage";
     gchar *args[] = { "remove", NULL };
@@ -64,7 +60,6 @@ void cmd_alias_remove_shows_usage_when_no_args(void **state)
 
 void cmd_alias_show_usage_when_invalid_subcmd(void **state)
 {
-    mock_cons_show();
     CommandHelp *help = malloc(sizeof(CommandHelp));
     help->usage = "some usage";
     gchar *args[] = { "blah", NULL };
@@ -79,7 +74,6 @@ void cmd_alias_show_usage_when_invalid_subcmd(void **state)
 
 void cmd_alias_add_adds_alias(void **state)
 {
-    mock_cons_show();
     CommandHelp *help = malloc(sizeof(CommandHelp));
     gchar *args[] = { "add", "hc", "/help commands", NULL };
 
@@ -97,7 +91,6 @@ void cmd_alias_add_adds_alias(void **state)
 
 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 };
 
@@ -115,7 +108,6 @@ void cmd_alias_add_shows_message_when_exists(void **state)
 
 void cmd_alias_remove_removes_alias(void **state)
 {
-    mock_cons_show();
     CommandHelp *help = malloc(sizeof(CommandHelp));
     gchar *args[] = { "remove", "hn", NULL };
 
@@ -135,7 +127,6 @@ void cmd_alias_remove_removes_alias(void **state)
 
 void cmd_alias_remove_shows_message_when_no_alias(void **state)
 {
-    mock_cons_show();
     CommandHelp *help = malloc(sizeof(CommandHelp));
     gchar *args[] = { "remove", "hn", NULL };
 
@@ -149,7 +140,6 @@ void cmd_alias_remove_shows_message_when_no_alias(void **state)
 
 void cmd_alias_list_shows_all_aliases(void **state)
 {
-    mock_cons_show_aliases();
     CommandHelp *help = malloc(sizeof(CommandHelp));
     gchar *args[] = { "list", NULL };
 
@@ -160,7 +150,7 @@ void cmd_alias_list_shows_all_aliases(void **state)
     prefs_add_alias("vn", "/vercheck off");
 
     // write a custom checker to check the correct list is passed
-    expect_cons_show_aliases();
+    expect_any(cons_show_aliases, aliases);
 
     gboolean result = cmd_alias(args, *help);
     assert_true(result);
diff --git a/tests/testsuite.c b/tests/testsuite.c
index a179db27..40910be6 100644
--- a/tests/testsuite.c
+++ b/tests/testsuite.c
@@ -390,7 +390,7 @@ int main(int argc, char* argv[]) {
         unit_test(handle_message_error_when_recipient_and_no_type),
         unit_test(handle_presence_error_when_no_recipient),
         unit_test(handle_presence_error_when_from_recipient),
-
+*/
         unit_test(cmd_alias_add_shows_usage_when_no_args),
         unit_test(cmd_alias_add_shows_usage_when_no_value),
         unit_test(cmd_alias_remove_shows_usage_when_no_args),
@@ -410,7 +410,7 @@ int main(int argc, char* argv[]) {
         unit_test_setup_teardown(cmd_alias_list_shows_all_aliases,
             load_preferences,
             close_preferences),
-
+/*
         unit_test_setup_teardown(test_muc_invites_add, muc_before_test, muc_after_test),
         unit_test_setup_teardown(test_muc_remove_invite, muc_before_test, muc_after_test),
         unit_test_setup_teardown(test_muc_invites_count_0, muc_before_test, muc_after_test),
diff --git a/tests/ui/stub_ui.c b/tests/ui/stub_ui.c
index 4b65fa39..dee743e3 100644
--- a/tests/ui/stub_ui.c
+++ b/tests/ui/stub_ui.c
@@ -313,7 +313,12 @@ void cons_show_status(const char * const barejid) {}
 void cons_show_info(PContact pcontact) {}
 void cons_show_caps(const char * const fulljid, resource_presence_t presence) {}
 void cons_show_themes(GSList *themes) {}
-void cons_show_aliases(GList *aliases) {}
+
+void cons_show_aliases(GList *aliases)
+{
+    check_expected(aliases);
+}
+
 void cons_show_login_success(ProfAccount *account) {}
 void cons_show_software_version(const char * const jid,
     const char * const presence, const char * const name,