1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-12-04 14:46:46 -05:00

Added cmd_win test

This commit is contained in:
James Booth 2014-04-01 23:14:53 +01:00
parent 404dde2810
commit 96e32fe178
4 changed files with 27 additions and 0 deletions

View File

@ -77,6 +77,7 @@ tests_sources = \
tests/test_server_events.c \
tests/test_muc.c \
tests/test_cmd_roster.c \
tests/test_cmd_win.c \
tests/testsuite.c
main_source = src/main.c

View File

@ -30,6 +30,7 @@
#include "test_cmd_join.h"
#include "test_muc.h"
#include "test_cmd_roster.h"
#include "test_cmd_win.h"
int main(int argc, char* argv[]) {
const UnitTest all_tests[] = {
@ -518,6 +519,8 @@ int main(int argc, char* argv[]) {
unit_test(cmd_roster_clearnick_shows_message_when_no_jid),
unit_test(cmd_roster_clearnick_shows_message_when_no_contact_exists),
unit_test(cmd_roster_clearnick_sends_name_change_request_with_empty_nick),
unit_test(cmd_win_shows_message_when_win_doesnt_exist),
};
return run_tests(all_tests);

View File

@ -177,6 +177,13 @@ void _mock_cons_show_roster(GSList *list)
check_expected(list);
}
static
gboolean _mock_ui_win_exists(int index)
{
check_expected(index);
return (gboolean)mock();
}
// bind mocks and stubs
void
@ -288,6 +295,12 @@ mock_cons_show_roster(void)
cons_show_roster = _mock_cons_show_roster;
}
void
mock_ui_win_exists(void)
{
ui_win_exists = _mock_ui_win_exists;
}
// expectations
void
@ -438,3 +451,10 @@ cons_show_roster_expect(GSList *list)
{
expect_any(_mock_cons_show_roster, list);
}
void
ui_win_exists_expect_and_return(int given_index, gboolean result)
{
expect_value(_mock_ui_win_exists, index, given_index);
will_return(_mock_ui_win_exists, result);
}

View File

@ -64,4 +64,7 @@ void ui_room_join_expect(char *room);
void mock_cons_show_roster(void);
void cons_show_roster_expect(GSList *list);
void mock_ui_win_exists(void);
void ui_win_exists_expect_and_return(int given_index, gboolean result);
#endif