test-istream-header-filter.c revision 82705acc82d625a60146b72b9296146dd8312261
/* Copyright (c) 2007-2015 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "str.h"
#include "istream.h"
#include "message-header-parser.h"
#include "istream-header-filter.h"
#include "test-common.h"
static void ATTR_NULL(3)
struct message_header_line *hdr,
{
/* drop first header */
}
}
static void test_istream_filter(void)
{
const char *input = "From: foo\nFrom: abc\nTo: bar\nSubject: plop\n\nhello world\n";
const char *output = "From: abc\n\nhello world\n";
const unsigned char *data;
test_begin("i_stream_create_header_filter(exclude)");
exclude_headers, 2,
filter_callback, (void *)NULL);
exclude_headers, 2,
(void *)NULL);
for (i = 1; i < input_len; i++) {
}
i_stream_seek(filter, 0);
while (i_stream_read(filter) > 0) ;
test_end();
}
static void ATTR_NULL(3)
struct message_header_line *hdr,
{
/* modify To header */
const char *new_to = "To: 123\n";
}
}
static void test_istream_edit(void)
{
const char *input = "From: foo\nTo: bar\n\nhello world\n";
const char *output = "From: foo\nTo: 123\n\nhello world\n";
const unsigned char *data;
test_begin("i_stream_create_header_filter(edit)");
NULL, 0,
edit_callback, (void *)NULL);
for (i = 1; i < input_len; i++) {
}
i_stream_seek(filter, 0);
while (i_stream_read(filter) > 0) ;
test_end();
}
static void test_istream_end_body_with_lf(void)
{
static const char *empty_strarray[] = { NULL };
const char *input = "From: foo\n\nhello world";
const char *output = "From: foo\n\nhello world\n";
const unsigned char *data;
test_begin("i_stream_create_header_filter(end_body_with_lf)");
empty_strarray, 0,
(void *)NULL);
for (i = 1; i < input_len; i++) {
}
i_stream_seek(filter, 0);
for (i = 1; i < input_len; i++) {
}
test_end();
}
int main(void)
{
static void (*test_functions[])(void) = {
};
return test_run(test_functions);
}