mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Added muc tests
This commit is contained in:
parent
0338d136e0
commit
63b3299b06
@ -85,6 +85,7 @@ test_sources = \
|
|||||||
tests/test_roster_list.c \
|
tests/test_roster_list.c \
|
||||||
tests/test_preferences.c \
|
tests/test_preferences.c \
|
||||||
tests/test_server_events.c \
|
tests/test_server_events.c \
|
||||||
|
tests/test_muc.c \
|
||||||
tests/testsuite.c
|
tests/testsuite.c
|
||||||
|
|
||||||
main_source = src/main.c
|
main_source = src/main.c
|
||||||
|
18
tests/test_muc.c
Normal file
18
tests/test_muc.c
Normal 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
1
tests/test_muc.h
Normal file
@ -0,0 +1 @@
|
|||||||
|
void test_muc_add_invite(void **state);
|
@ -23,6 +23,7 @@
|
|||||||
#include "test_preferences.h"
|
#include "test_preferences.h"
|
||||||
#include "test_server_events.h"
|
#include "test_server_events.h"
|
||||||
#include "test_cmd_alias.h"
|
#include "test_cmd_alias.h"
|
||||||
|
#include "test_muc.h"
|
||||||
|
|
||||||
#define PROF_RUN_TESTS(name) fprintf(stderr, "\n-> Running %s\n", #name); \
|
#define PROF_RUN_TESTS(name) fprintf(stderr, "\n-> Running %s\n", #name); \
|
||||||
fflush(stderr); \
|
fflush(stderr); \
|
||||||
@ -427,6 +428,10 @@ int main(int argc, char* argv[]) {
|
|||||||
close_preferences),
|
close_preferences),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const UnitTest muc_tests[] = {
|
||||||
|
unit_test(test_muc_add_invite),
|
||||||
|
};
|
||||||
|
|
||||||
int bak, bak2, new;
|
int bak, bak2, new;
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
@ -456,6 +461,7 @@ int main(int argc, char* argv[]) {
|
|||||||
PROF_RUN_TESTS(preferences_tests);
|
PROF_RUN_TESTS(preferences_tests);
|
||||||
PROF_RUN_TESTS(cmd_alias_tests);
|
PROF_RUN_TESTS(cmd_alias_tests);
|
||||||
PROF_RUN_TESTS(server_events_tests);
|
PROF_RUN_TESTS(server_events_tests);
|
||||||
|
PROF_RUN_TESTS(muc_tests);
|
||||||
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
dup2(bak, 1);
|
dup2(bak, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user