forked from boostorg/beast
Fix all async initiating functions with use_awaitable:
Add trait:
is_completion_token_for
Fixes for
buffered_read_stream
Add tests for
basic_stream
buffered_read_stream
flat_stream
http (all)
websocket (all)
resolves #1920
This commit is contained in:
@@ -17,6 +17,9 @@
|
||||
#include <boost/beast/core/role.hpp>
|
||||
#include <initializer_list>
|
||||
#include <vector>
|
||||
#if BOOST_ASIO_HAS_CO_AWAIT
|
||||
#include <boost/asio/use_awaitable.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace beast {
|
||||
@@ -208,11 +211,30 @@ public:
|
||||
check({1,2,3,4}, 3, 3, true);
|
||||
}
|
||||
|
||||
#if BOOST_ASIO_HAS_CO_AWAIT
|
||||
void testAwaitableCompiles(
|
||||
flat_stream<test::stream>& stream,
|
||||
net::mutable_buffer rxbuf,
|
||||
net::const_buffer txbuf)
|
||||
{
|
||||
static_assert(std::is_same_v<
|
||||
net::awaitable<std::size_t>, decltype(
|
||||
stream.async_read_some(rxbuf, net::use_awaitable))>);
|
||||
|
||||
static_assert(std::is_same_v<
|
||||
net::awaitable<std::size_t>, decltype(
|
||||
stream.async_write_some(txbuf, net::use_awaitable))>);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
run() override
|
||||
{
|
||||
testMembers();
|
||||
testSplit();
|
||||
#if BOOST_ASIO_HAS_CO_AWAIT
|
||||
boost::ignore_unused(&flat_stream_test::testAwaitableCompiles);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user