test-istream-header-filter.c revision 76a71915c6452a4bee9a8ae89ddbdf58fa941dee
/* Copyright (c) 2007-2016 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
{
const unsigned char *data;
for (i = 1; i < input_len; i++) {
}
/* run again to make sure it's still correct the second time */
i_stream_seek(filter, 0);
while (i_stream_read(filter) > 0) ;
}
static void ATTR_NULL(3)
struct message_header_line *hdr,
{
/* drop 1) first header, 2) X-Drop header */
}
}
static void test_istream_filter(void)
{
const char *input = "From: foo\nFrom: abc\nTo: bar\nSubject: plop\nX-Drop: 1\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)");
filter_callback, (void *)NULL);
(void *)NULL);
for (i = 1; i < input_len; i++) {
}
i_stream_seek(filter, 0);
while (i_stream_read(filter) > 0) ;
test_end();
}
{
unsigned int i;
for (i = 0; i < count; i++)
}
static void ATTR_NULL(3)
struct message_header_line *hdr,
{
}
static void test_istream_filter_large_buffer(void)
{
const unsigned char *data;
const char *p;
unsigned int i;
test_begin("i_stream_create_header_filter(large buffer)");
NULL, 0,
(void *)NULL);
for (i = 0; i < 2; i++) {
for (;;) {
if (ret == -1)
break;
if (ret == -2) {
}
}
p = strchr(p, '\n');
/* seek back and retry once with caching */
i_stream_seek(filter, 0);
str_truncate(output, 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";
test_begin("i_stream_create_header_filter(edit)");
NULL, 0,
edit_callback, (void *)NULL);
test_end();
}
static void test_istream_end_body_with_lf(void)
{
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)");
NULL, 0,
(void *)NULL);
for (i = 1; i < input_len; i++) {
}
i_stream_seek(filter, 0);
for (i = 1; i < input_len; i++) {
}
test_end();
}
static void ATTR_NULL(3)
struct message_header_line *hdr,
{
}
static void test_istream_strip_eoh(void)
{
const char *input = "From: foo\nTo: bar\n\nhello world\n";
const char *output = "From: foo\nTo: bar\nhello world\n";
test_begin("i_stream_create_header_filter(edit)");
strip_eoh_callback, (void *)NULL);
test_end();
}
int main(void)
{
static void (*test_functions[])(void) = {
};
return test_run(test_functions);
}