test-message-parser.c revision 5f237cf1915127fe143ac4c1d3cb4d1139f3b97d
/* Copyright (c) 2007-2009 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "istream.h"
#include "message-parser.h"
#include "test-common.h"
static const char test_msg[] =
"Return-Path: <test@example.org>\n"
"Subject: Hello world\n"
"From: Test User <test@example.org>\n"
"To: Another User <test2@example.org>\n"
"Message-Id: <1.2.3.4@example>\n"
"Mime-Version: 1.0\n"
"Date: Sun, 23 May 2007 04:58:08 +0300\n"
" protocol=\"application/pgp-signature\";\n"
" boundary=\"=-GNQXLhuj24Pl1aCkk4/d\"\n"
"\n"
"--=-GNQXLhuj24Pl1aCkk4/d\n"
"Content-Transfer-Encoding: quoted-printable\n"
"\n"
"There was a day=20\n"
"a happy=20day\n"
"\n"
"--=-GNQXLhuj24Pl1aCkk4/d\n"
"Content-Type: application/pgp-signature; name=signature.asc\n"
"\n"
"-----BEGIN PGP SIGNATURE-----\n"
"\n"
"invalid\n"
"-----END PGP SIGNATURE-----\n"
"\n"
"--=-GNQXLhuj24Pl1aCkk4/d--\n"
"\n"
"\n";
{
return FALSE;
return FALSE;
return FALSE;
}
return FALSE;
}
return TRUE;
}
static void test_message_parser_small_blocks(void)
{
struct message_parser_ctx *parser;
struct message_block block;
unsigned int i, end_of_headers_idx;
int ret;
test_begin("message parser in small blocks");
/* full parsing */
test_assert(ret < 0);
/* parsing in small blocks */
i_stream_seek(input, 0);
if (i > TEST_MSG_LEN*2)
&block)) > 0) ;
}
/* parsing in small blocks from preparsed parts */
i_stream_seek(input, 0);
if (i > TEST_MSG_LEN*2)
&block)) > 0) ;
}
pool_unref(&pool);
test_end();
}
int main(void)
{
static void (*test_functions[])(void) = {
};
return test_run(test_functions);
}