diff --git a/test/testbuckets.c b/test/testbuckets.c index 34466e5e39..5616fd9a01 100644 --- a/test/testbuckets.c +++ b/test/testbuckets.c @@ -209,6 +209,36 @@ static void test_splitline(abts_case *tc, void *data) apr_bucket_alloc_destroy(ba); } +static void test_splitline_eos(abts_case *tc, void *data) +{ + apr_bucket_alloc_t *ba = apr_bucket_alloc_create(p); + apr_bucket_brigade *bin, *bout; + apr_bucket *eos = apr_bucket_eos_create(ba); + + bin = make_simple_brigade(ba, "blah blah\n", + "foo foo"); + APR_BRIGADE_INSERT_TAIL(bin, eos); + + bout = apr_brigade_create(p, ba); + + APR_ASSERT_SUCCESS(tc, "split line eos #1", + apr_brigade_split_line(bout, bin, + APR_BLOCK_READ, 100)); + + flatten_match(tc, "split line eos", bout, "blah blah\n"); + + apr_brigade_cleanup(bout); + APR_ASSERT_SUCCESS(tc, "split line eos #2", + apr_brigade_split_line(bout, bin, + APR_BLOCK_READ, 100)); + + flatten_match(tc, "split line eos", bout, "foo foo"); + + apr_brigade_destroy(bout); + apr_brigade_destroy(bin); + apr_bucket_alloc_destroy(ba); +} + static void test_splitboundary(abts_case *tc, void *data) { apr_bucket_alloc_t *ba = apr_bucket_alloc_create(p); @@ -559,6 +589,9 @@ static void test_write_putstrs(abts_case *tc, void *data) apr_brigade_putstrs(bb, NULL, NULL, "2", "34", "567", "8", "9a", "bcd", "e", "f", "gh", "i", NULL); apr_brigade_putstrs(bb, NULL, NULL, "j", NULL); + e = apr_bucket_eos_create(ba); + APR_BRIGADE_INSERT_HEAD(bb, e); + APR_ASSERT_SUCCESS(tc, "apr_brigade_flatten", apr_brigade_flatten(bb, buf, &len)); ABTS_STR_NEQUAL(tc, expect, buf, strlen(expect)); @@ -577,6 +610,7 @@ abts_suite *testbuckets(abts_suite *suite) abts_run_test(suite, test_split, NULL); abts_run_test(suite, test_bwrite, NULL); abts_run_test(suite, test_splitline, NULL); + abts_run_test(suite, test_splitline_eos, NULL); abts_run_test(suite, test_splitboundary, NULL); abts_run_test(suite, test_splits, NULL); abts_run_test(suite, test_insertfile, NULL);