dovecot-2.0: test-message-parser: Improvements.
dovecot at dovecot.org
dovecot at dovecot.org
Tue May 26 23:52:04 EEST 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/ca62d712d149
changeset: 9389:ca62d712d149
user: Timo Sirainen <tss at iki.fi>
date: Tue May 26 16:29:31 2009 -0400
description:
test-message-parser: Improvements.
diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
src/lib-mail/test-message-parser.c | 8 +++++---
diffs (32 lines):
diff -r 54a56772aeb8 -r ca62d712d149 src/lib-mail/test-message-parser.c
--- a/src/lib-mail/test-message-parser.c Tue May 26 15:23:34 2009 -0400
+++ b/src/lib-mail/test-message-parser.c Tue May 26 16:29:31 2009 -0400
@@ -98,7 +98,8 @@ static void test_message_parser_small_bl
test_istream_set_allow_eof(input, TRUE);
while ((ret = message_parser_parse_next_block(parser,
&block)) > 0) ;
- test_assert(ret == 0 || i > TEST_MSG_LEN*2);
+ test_assert((ret == 0 && i <= TEST_MSG_LEN*2) ||
+ (ret < 0 && i > TEST_MSG_LEN*2));
}
test_assert(message_parser_deinit(&parser, &parts2) == 0);
test_assert(msg_parts_cmp(parts, parts2));
@@ -107,7 +108,7 @@ static void test_message_parser_small_bl
i_stream_seek(input, 0);
test_istream_set_allow_eof(input, FALSE);
- end_of_headers_idx = strstr(test_msg, "\n-----") - test_msg;
+ end_of_headers_idx = (strstr(test_msg, "\n-----") - test_msg);
parser = message_parser_init_from_parts(parts, input, 0,
MESSAGE_PARSER_FLAG_SKIP_BODY_BLOCK);
for (i = 1; i <= TEST_MSG_LEN*2+1; i++) {
@@ -116,7 +117,8 @@ static void test_message_parser_small_bl
test_istream_set_allow_eof(input, TRUE);
while ((ret = message_parser_parse_next_block(parser,
&block)) > 0) ;
- test_assert(ret == 0 || i >= end_of_headers_idx);
+ test_assert((ret == 0 && i/2 <= end_of_headers_idx) ||
+ (ret < 0 && i/2 > end_of_headers_idx));
}
test_assert(message_parser_deinit(&parser, &parts2) == 0);
test_assert(msg_parts_cmp(parts, parts2));
More information about the dovecot-cvs
mailing list