return -1;
}
+static ssize_t test_noread(struct istream_private *stream ATTR_UNUSED)
+{
+ return 0;
+}
+
struct istream *test_istream_create(const char *data)
{
struct istream *input;
input->real_stream->pos = size;
}
+void test_istream_set_allow_eof(struct istream *input, bool allow)
+{
+ input->real_stream->read = allow ? test_read : test_noread;
+}
+
void test_out(const char *name, bool success)
{
test_out_reason(name, success, NULL);
struct istream *test_istream_create(const char *data);
void test_istream_set_size(struct istream *input, uoff_t size);
+void test_istream_set_allow_eof(struct istream *input, bool allow);
void test_out(const char *name, bool success);
void test_out_reason(const char *name, bool success, const char *reason);
i_stream_unref(&input);
input = test_istream_create(test_msg);
+ test_istream_set_allow_eof(input, FALSE);
parser = message_parser_init(pool, input, 0, 0);
- for (i = 1; i <= TEST_MSG_LEN; i++) {
- test_istream_set_size(input, i);
+ for (i = 1; i <= TEST_MSG_LEN*2+1; i++) {
+ test_istream_set_size(input, i/2);
+ if (i > TEST_MSG_LEN*2)
+ test_istream_set_allow_eof(input, TRUE);
while ((ret = message_parser_parse_next_block(parser,
&block)) > 0) ;
- if (ret < 0 && i < TEST_MSG_LEN) {
+ if (ret < 0 && i < TEST_MSG_LEN*2) {
success = FALSE;
break;
}