2015-05-30 19:12:13 -04:00
|
|
|
#include <glib.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <setjmp.h>
|
|
|
|
#include <cmocka.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <stabber.h>
|
|
|
|
#include <expect.h>
|
|
|
|
|
|
|
|
#include "proftest.h"
|
|
|
|
|
|
|
|
void
|
|
|
|
message_send(void **state)
|
|
|
|
{
|
2015-06-13 14:41:11 -04:00
|
|
|
prof_connect();
|
2015-05-30 19:12:13 -04:00
|
|
|
|
|
|
|
prof_input("/msg somejid@someserver.com Hi there");
|
|
|
|
|
|
|
|
assert_true(stbbr_received(
|
2015-12-29 19:12:24 -05:00
|
|
|
"<message id='*' to='somejid@someserver.com' type='chat'>"
|
2015-05-30 19:12:13 -04:00
|
|
|
"<body>Hi there</body>"
|
|
|
|
"</message>"
|
|
|
|
));
|
|
|
|
|
|
|
|
assert_true(prof_output_regex("me: .+Hi there"));
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2015-12-21 19:27:37 -05:00
|
|
|
message_receive_console(void **state)
|
2015-05-30 19:12:13 -04:00
|
|
|
{
|
2015-06-13 14:41:11 -04:00
|
|
|
prof_connect();
|
2015-05-30 19:12:13 -04:00
|
|
|
|
|
|
|
stbbr_send(
|
2015-12-29 19:12:24 -05:00
|
|
|
"<message id='message1' to='stabber@localhost' from='someuser@chatserv.org/laptop' type='chat'>"
|
2015-05-30 19:12:13 -04:00
|
|
|
"<body>How are you?</body>"
|
|
|
|
"</message>"
|
|
|
|
);
|
|
|
|
|
2015-12-20 18:26:05 -05:00
|
|
|
assert_true(prof_output_exact("<< chat message: someuser@chatserv.org/laptop (win 2)"));
|
2015-05-30 19:12:13 -04:00
|
|
|
}
|
2015-12-21 19:27:37 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
message_receive_chatwin(void **state)
|
|
|
|
{
|
|
|
|
prof_connect();
|
|
|
|
|
|
|
|
prof_input("/msg someuser@chatserv.org");
|
2015-12-29 19:12:24 -05:00
|
|
|
assert_true(prof_output_exact("someuser@chatserv.org"));
|
2015-12-21 19:27:37 -05:00
|
|
|
|
|
|
|
stbbr_send(
|
2015-12-29 19:12:24 -05:00
|
|
|
"<message id='message1' to='stabber@localhost' from='someuser@chatserv.org/laptop' type='chat'>"
|
2015-12-21 19:27:37 -05:00
|
|
|
"<body>How are you?</body>"
|
|
|
|
"</message>"
|
|
|
|
);
|
|
|
|
|
|
|
|
assert_true(prof_output_regex("someuser@chatserv.org/laptop: .+How are you?"));
|
|
|
|
}
|