mirror of
https://github.com/boostorg/beast.git
synced 2025-08-02 14:24:31 +02:00
Add move-only handler tests
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
Version 161:
|
Version 161:
|
||||||
|
|
||||||
* Don't copy the handler in write_some_op
|
* Don't copy the handler in write_some_op
|
||||||
|
* Add move-only handler tests
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@@ -731,8 +731,8 @@ read(
|
|||||||
The object must remain valid at least until the
|
The object must remain valid at least until the
|
||||||
handler is called; ownership is not transferred.
|
handler is called; ownership is not transferred.
|
||||||
|
|
||||||
@param handler The handler to be called when the operation
|
@param handler Invoked when the operation completes.
|
||||||
completes. Copies will be made of the handler as required.
|
The handler may be moved or copied as needed.
|
||||||
The equivalent function signature of the handler must be:
|
The equivalent function signature of the handler must be:
|
||||||
@code void handler(
|
@code void handler(
|
||||||
error_code const& error, // result of operation,
|
error_code const& error, // result of operation,
|
||||||
|
@@ -610,10 +610,19 @@ public:
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
testMoveOnly()
|
||||||
|
{
|
||||||
|
boost::asio::io_context ioc;
|
||||||
|
stream<test::stream> ws{ioc};
|
||||||
|
ws.async_accept(move_only_handler{});
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
run() override
|
run() override
|
||||||
{
|
{
|
||||||
testAccept();
|
testAccept();
|
||||||
|
testMoveOnly();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -622,12 +622,21 @@ public:
|
|||||||
asio_handler_is_continuation(&op);
|
asio_handler_is_continuation(&op);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
testMoveOnly()
|
||||||
|
{
|
||||||
|
boost::asio::io_context ioc;
|
||||||
|
stream<test::stream> ws{ioc};
|
||||||
|
ws.async_close({}, move_only_handler{});
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
run() override
|
run() override
|
||||||
{
|
{
|
||||||
testClose();
|
testClose();
|
||||||
testSuspend();
|
testSuspend();
|
||||||
testContHook();
|
testContHook();
|
||||||
|
testMoveOnly();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -484,6 +484,14 @@ public:
|
|||||||
"permessage-deflate");
|
"permessage-deflate");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
testMoveOnly()
|
||||||
|
{
|
||||||
|
boost::asio::io_context ioc;
|
||||||
|
stream<test::stream> ws{ioc};
|
||||||
|
ws.async_handshake("", "", move_only_handler{});
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
run() override
|
run() override
|
||||||
{
|
{
|
||||||
@@ -491,6 +499,7 @@ public:
|
|||||||
testExtRead();
|
testExtRead();
|
||||||
testExtWrite();
|
testExtWrite();
|
||||||
testExtNegotiate();
|
testExtNegotiate();
|
||||||
|
testMoveOnly();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -435,12 +435,21 @@ public:
|
|||||||
asio_handler_is_continuation(&op);
|
asio_handler_is_continuation(&op);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
testMoveOnly()
|
||||||
|
{
|
||||||
|
boost::asio::io_context ioc;
|
||||||
|
stream<test::stream> ws{ioc};
|
||||||
|
ws.async_ping({}, move_only_handler{});
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
run() override
|
run() override
|
||||||
{
|
{
|
||||||
testPing();
|
testPing();
|
||||||
testSuspend();
|
testSuspend();
|
||||||
testContHook();
|
testContHook();
|
||||||
|
testMoveOnly();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -639,6 +639,16 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
testMoveOnly()
|
||||||
|
{
|
||||||
|
boost::asio::io_context ioc;
|
||||||
|
stream<test::stream> ws{ioc};
|
||||||
|
ws.async_read_some(
|
||||||
|
boost::asio::mutable_buffer{},
|
||||||
|
move_only_handler{});
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
run() override
|
run() override
|
||||||
{
|
{
|
||||||
@@ -649,6 +659,7 @@ public:
|
|||||||
testIssue954();
|
testIssue954();
|
||||||
testIssueBF1();
|
testIssueBF1();
|
||||||
testIssueBF2();
|
testIssueBF2();
|
||||||
|
testMoveOnly();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -42,6 +42,19 @@ public:
|
|||||||
using ws_type =
|
using ws_type =
|
||||||
websocket::stream<test::stream&>;
|
websocket::stream<test::stream&>;
|
||||||
|
|
||||||
|
struct move_only_handler
|
||||||
|
{
|
||||||
|
move_only_handler() = default;
|
||||||
|
move_only_handler(move_only_handler&&) = default;
|
||||||
|
move_only_handler(move_only_handler const&) = delete;
|
||||||
|
|
||||||
|
template<class... Args>
|
||||||
|
void
|
||||||
|
operator()(Args&&...) const
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
enum class kind
|
enum class kind
|
||||||
{
|
{
|
||||||
sync,
|
sync,
|
||||||
|
@@ -631,6 +631,16 @@ public:
|
|||||||
asio_handler_is_continuation(&op);
|
asio_handler_is_continuation(&op);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
testMoveOnly()
|
||||||
|
{
|
||||||
|
boost::asio::io_context ioc;
|
||||||
|
stream<test::stream> ws{ioc};
|
||||||
|
ws.async_write_some(
|
||||||
|
true, boost::asio::const_buffer{},
|
||||||
|
move_only_handler{});
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
run() override
|
run() override
|
||||||
{
|
{
|
||||||
@@ -639,6 +649,7 @@ public:
|
|||||||
testAsyncWriteFrame();
|
testAsyncWriteFrame();
|
||||||
testIssue300();
|
testIssue300();
|
||||||
testContHook();
|
testContHook();
|
||||||
|
testMoveOnly();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user