mirror of
https://github.com/weechat/weechat.git
synced 2026-06-12 14:14:48 +02:00
tests: add macros RECORD_CHECK_NO_MSG and RECORD_CHECK_MSG
This commit is contained in:
@@ -20,6 +20,36 @@
|
||||
#ifndef WEECHAT_TESTS_RECORD_H
|
||||
#define WEECHAT_TESTS_RECORD_H
|
||||
|
||||
#define RECORD_CHECK_NO_MSG() \
|
||||
if (record_count_messages () > 0) \
|
||||
{ \
|
||||
char **msg = string_dyn_alloc (256); \
|
||||
string_dyn_concat ( \
|
||||
msg, \
|
||||
"Unexpected message(s) displayed:\n: ", -1); \
|
||||
record_dump (msg); \
|
||||
FAIL(string_dyn_free (msg, 0)); \
|
||||
}
|
||||
|
||||
#define RECORD_CHECK_MSG(__buffer, __prefix, __message, __tags) \
|
||||
if (!record_search (__buffer, __prefix, __message, __tags)) \
|
||||
{ \
|
||||
char **msg = string_dyn_alloc (256); \
|
||||
string_dyn_concat (msg, "Message not displayed: ", -1); \
|
||||
string_dyn_concat (msg, "buffer=\"", -1); \
|
||||
string_dyn_concat (msg, __buffer, -1); \
|
||||
string_dyn_concat (msg, "\", prefix=\"", -1); \
|
||||
string_dyn_concat (msg, __prefix, -1); \
|
||||
string_dyn_concat (msg, "\", message=\"", -1); \
|
||||
string_dyn_concat (msg, __message, -1); \
|
||||
string_dyn_concat (msg, "\", tags=\"", -1); \
|
||||
string_dyn_concat (msg, __tags, -1); \
|
||||
string_dyn_concat (msg, "\"\n", -1); \
|
||||
string_dyn_concat (msg, "All messages displayed:\n", -1); \
|
||||
record_dump (msg); \
|
||||
FAIL(string_dyn_free (msg, 0)); \
|
||||
}
|
||||
|
||||
extern struct t_arraylist *recorded_messages;
|
||||
|
||||
extern void record_start ();
|
||||
|
||||
Reference in New Issue
Block a user