mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-18 20:46:21 +00:00
60 lines
1.3 KiB
C
60 lines
1.3 KiB
C
/*
|
|
* test_message.c
|
|
*
|
|
* Copyright (C) 2015 James Booth <boothj5@gmail.com>
|
|
* Copyright (C) 2026 - 2026 Michael Vetter <jubalh@iodoru.org>
|
|
*
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
*/
|
|
#include <glib.h>
|
|
#include "prof_cmocka.h"
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include <stabber.h>
|
|
|
|
#include "proftest.h"
|
|
|
|
void
|
|
message_send(void** state)
|
|
{
|
|
prof_connect();
|
|
|
|
prof_input("/msg somejid@someserver.com Hi there");
|
|
|
|
assert_true(stbbr_received(
|
|
"<message id='*' to='somejid@someserver.com' type='chat'>"
|
|
"<body>Hi there</body>"
|
|
"</message>"));
|
|
|
|
assert_true(prof_output_exact("me: Hi there"));
|
|
}
|
|
|
|
void
|
|
message_receive_console(void** state)
|
|
{
|
|
prof_connect();
|
|
|
|
stbbr_send(
|
|
"<message id='message1' to='stabber@localhost' from='someuser@chatserv.org/laptop' type='chat'>"
|
|
"<body>How are you?</body>"
|
|
"</message>");
|
|
|
|
assert_true(prof_output_exact("<< chat message: someuser@chatserv.org/laptop (win 2)"));
|
|
}
|
|
|
|
void
|
|
message_receive_chatwin(void** state)
|
|
{
|
|
prof_connect();
|
|
|
|
prof_input("/msg someuser@chatserv.org");
|
|
|
|
stbbr_send(
|
|
"<message id='message1' to='stabber@localhost' from='someuser@chatserv.org/laptop' type='chat'>"
|
|
"<body>How are you?</body>"
|
|
"</message>");
|
|
|
|
assert_true(prof_output_regex("someuser@chatserv.org/laptop: How are you\\?"));
|
|
}
|