dovecot-2.0: lib-test: Added test_istream_create().
dovecot at dovecot.org
dovecot at dovecot.org
Mon Oct 26 23:09:00 EET 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/7c3605774b93
changeset: 10185:7c3605774b93
user: Timo Sirainen <tss at iki.fi>
date: Mon Oct 26 17:07:20 2009 -0400
description:
lib-test: Added test_istream_create().
diffstat:
2 files changed, 9 insertions(+), 3 deletions(-)
src/lib-test/test-common.c | 11 ++++++++---
src/lib-test/test-common.h | 1 +
diffs (46 lines):
diff -r 891d8650f3f8 -r 7c3605774b93 src/lib-test/test-common.c
--- a/src/lib-test/test-common.c Mon Oct 26 17:07:06 2009 -0400
+++ b/src/lib-test/test-common.c Mon Oct 26 17:07:20 2009 -0400
@@ -73,12 +73,12 @@ static void test_seek(struct istream_pri
stream->pos = stream->skip;
}
-struct istream *test_istream_create(const char *data)
+struct istream *test_istream_create_data(const void *data, size_t size)
{
struct test_istream *tstream;
tstream = i_new(struct test_istream, 1);
- tstream->istream.buffer = (const void *)data;
+ tstream->istream.buffer = data;
tstream->istream.read = test_read;
tstream->istream.seek = test_seek;
@@ -86,10 +86,15 @@ struct istream *test_istream_create(cons
tstream->istream.istream.blocking = FALSE;
tstream->istream.istream.seekable = TRUE;
(void)i_stream_create(&tstream->istream, NULL, -1);
- tstream->istream.statbuf.st_size = tstream->max_pos = strlen(data);
+ tstream->istream.statbuf.st_size = tstream->max_pos = size;
tstream->allow_eof = TRUE;
tstream->max_buffer_size = (size_t)-1;
return &tstream->istream.istream;
+}
+
+struct istream *test_istream_create(const char *data)
+{
+ return test_istream_create_data(data, strlen(data));
}
void test_istream_set_allow_eof(struct istream *input, bool allow)
diff -r 891d8650f3f8 -r 7c3605774b93 src/lib-test/test-common.h
--- a/src/lib-test/test-common.h Mon Oct 26 17:07:06 2009 -0400
+++ b/src/lib-test/test-common.h Mon Oct 26 17:07:20 2009 -0400
@@ -2,6 +2,7 @@
#define TEST_COMMON_H
struct istream *test_istream_create(const char *data);
+struct istream *test_istream_create_data(const void *data, size_t size);
void test_istream_set_size(struct istream *input, uoff_t size);
void test_istream_set_allow_eof(struct istream *input, bool allow);
void test_istream_set_max_buffer_size(struct istream *input, size_t size);
More information about the dovecot-cvs
mailing list