Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/boost/capy/io/any_write_sink.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ template<ConstBufferSequence CB>
io_task<std::size_t>
any_write_sink::write(CB buffers)
{
buffer_param<CB> bp(buffers);
const_buffer_param<CB> bp(buffers);
std::size_t total = 0;

for(;;)
Expand Down
22 changes: 22 additions & 0 deletions test/unit/io/any_write_sink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,27 @@ class any_write_sink_test
BOOST_TEST(r.success);
}

void
testWriteMutableSequence()
{
test::fuse f;
auto r = f.armed([&](test::fuse&) -> task<> {
test::write_sink ws(f);

any_write_sink aws(&ws);

std::string body = "hello world";
auto [ec, n] = co_await aws.write(make_buffer(body));
if(ec)
co_return;

BOOST_TEST_EQ(n, 11u);
BOOST_TEST_EQ(ws.data(), "hello world");
BOOST_TEST(!ws.eof_called());
});
BOOST_TEST(r.success);
}

void
testWriteMultiple()
{
Expand Down Expand Up @@ -775,6 +796,7 @@ class any_write_sink_test
testWriteSomeEmptyBuffer();
testWriteEmptyBuffer();
testWrite();
testWriteMutableSequence();
testWriteMultiple();
testWriteBufferSequence();
testWriteSingleBuffer();
Expand Down
Loading