1
0
mirror of https://github.com/profanity-im/profanity.git synced 2024-09-22 19:45:54 -04:00

Added muc tests

This commit is contained in:
James Booth 2014-01-30 23:32:52 +00:00
parent 0338d136e0
commit 63b3299b06
4 changed files with 26 additions and 0 deletions

View File

@ -85,6 +85,7 @@ test_sources = \
tests/test_roster_list.c \
tests/test_preferences.c \
tests/test_server_events.c \
tests/test_muc.c \
tests/testsuite.c
main_source = src/main.c

18
tests/test_muc.c Normal file
View File

@ -0,0 +1,18 @@
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
#include <stdlib.h>
#include "muc.h"
void test_muc_add_invite(void **state)
{
char *room = "room@conf.server";
muc_init();
muc_add_invite(room);
gboolean invite_exists = muc_invites_include(room);
assert_true(invite_exists);
}

1
tests/test_muc.h Normal file
View File

@ -0,0 +1 @@
void test_muc_add_invite(void **state);

View File

@ -23,6 +23,7 @@
#include "test_preferences.h"
#include "test_server_events.h"
#include "test_cmd_alias.h"
#include "test_muc.h"
#define PROF_RUN_TESTS(name) fprintf(stderr, "\n-> Running %s\n", #name); \
fflush(stderr); \
@ -427,6 +428,10 @@ int main(int argc, char* argv[]) {
close_preferences),
};
const UnitTest muc_tests[] = {
unit_test(test_muc_add_invite),
};
int bak, bak2, new;
fflush(stdout);
fflush(stderr);
@ -456,6 +461,7 @@ int main(int argc, char* argv[]) {
PROF_RUN_TESTS(preferences_tests);
PROF_RUN_TESTS(cmd_alias_tests);
PROF_RUN_TESTS(server_events_tests);
PROF_RUN_TESTS(muc_tests);
fflush(stdout);
dup2(bak, 1);