1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-11-03 19:37:16 -05:00

Added cmd_sub tests

This commit is contained in:
James Booth 2014-12-25 00:05:13 +00:00
parent c47b4261f3
commit 9537592b52
3 changed files with 6 additions and 7 deletions

View File

@ -75,6 +75,7 @@ tests_sources = \
tests/test_cmd_rooms.c tests/test_cmd_rooms.h \ tests/test_cmd_rooms.c tests/test_cmd_rooms.h \
tests/test_cmd_roster.c tests/test_cmd_roster.h \ tests/test_cmd_roster.c tests/test_cmd_roster.h \
tests/test_cmd_statuses.c tests/test_cmd_statuses.h \ tests/test_cmd_statuses.c tests/test_cmd_statuses.h \
tests/test_cmd_sub.c tests/test_cmd_sub.h \
tests/test_autocomplete.c tests/test_autocomplete.h \ tests/test_autocomplete.c tests/test_autocomplete.h \
tests/testsuite.c tests/testsuite.c

View File

@ -7,20 +7,18 @@
#include <glib.h> #include <glib.h>
#include "xmpp/xmpp.h" #include "xmpp/xmpp.h"
#include "xmpp/mock_xmpp.h"
#include "ui/ui.h" #include "ui/ui.h"
#include "ui/mock_ui.h" #include "ui/stub_ui.h"
#include "command/commands.h" #include "command/commands.h"
void cmd_sub_shows_message_when_not_connected(void **state) void cmd_sub_shows_message_when_not_connected(void **state)
{ {
mock_cons_show();
CommandHelp *help = malloc(sizeof(CommandHelp)); CommandHelp *help = malloc(sizeof(CommandHelp));
gchar *args[] = { NULL }; gchar *args[] = { NULL };
mock_connection_status(JABBER_DISCONNECTED); will_return(jabber_get_connection_status, JABBER_DISCONNECTED);
expect_cons_show("You are currently not connected."); expect_cons_show("You are currently not connected.");
@ -32,12 +30,11 @@ void cmd_sub_shows_message_when_not_connected(void **state)
void cmd_sub_shows_usage_when_no_arg(void **state) void cmd_sub_shows_usage_when_no_arg(void **state)
{ {
mock_cons_show();
CommandHelp *help = malloc(sizeof(CommandHelp)); CommandHelp *help = malloc(sizeof(CommandHelp));
help->usage = "Some usage"; help->usage = "Some usage";
gchar *args[] = { NULL }; gchar *args[] = { NULL };
mock_connection_status(JABBER_CONNECTED); will_return(jabber_get_connection_status, JABBER_CONNECTED);
expect_cons_show("Usage: Some usage"); expect_cons_show("Usage: Some usage");

View File

@ -291,9 +291,10 @@ int main(int argc, char* argv[]) {
unit_test(cmd_account_clear_shows_usage_when_one_arg), unit_test(cmd_account_clear_shows_usage_when_one_arg),
unit_test(cmd_account_clear_shows_message_when_account_doesnt_exist), unit_test(cmd_account_clear_shows_message_when_account_doesnt_exist),
unit_test(cmd_account_clear_shows_message_when_invalid_property), unit_test(cmd_account_clear_shows_message_when_invalid_property),
/*
unit_test(cmd_sub_shows_message_when_not_connected), unit_test(cmd_sub_shows_message_when_not_connected),
unit_test(cmd_sub_shows_usage_when_no_arg), unit_test(cmd_sub_shows_usage_when_no_arg),
/*
unit_test(contact_in_group), unit_test(contact_in_group),
unit_test(contact_not_in_group), unit_test(contact_not_in_group),