summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/asio/src/tests/unit/experimental/coro/partial.cpp
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/asio/src/tests/unit/experimental/coro/partial.cpp')
-rw-r--r--3rdparty/asio/src/tests/unit/experimental/coro/partial.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/3rdparty/asio/src/tests/unit/experimental/coro/partial.cpp b/3rdparty/asio/src/tests/unit/experimental/coro/partial.cpp
new file mode 100644
index 00000000000..6a615a47461
--- /dev/null
+++ b/3rdparty/asio/src/tests/unit/experimental/coro/partial.cpp
@@ -0,0 +1,45 @@
+//
+// experimental/coro/partial.cpp
+// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+//
+// Copyright (c) 2021 Klemens D. Morgenstern
+// (klemens dot morgenstern at gmx dot net)
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+
+// Disable autolinking for unit tests.
+#if !defined(BOOST_ALL_NO_LIB)
+#define BOOST_ALL_NO_LIB 1
+#endif // !defined(BOOST_ALL_NO_LIB)
+
+// Test that header file is self-contained.
+#include "asio/experimental/coro.hpp"
+
+#include "asio/io_context.hpp"
+#include "../../unit_test.hpp"
+
+using namespace asio::experimental;
+
+namespace coro {
+
+void partial()
+{
+ asio::io_context ctx;
+ bool ran = false;
+ auto p = detail::post_coroutine(ctx, [&]{ran = true;});
+ ASIO_CHECK(!ran);
+ p.resume();
+ ASIO_CHECK(!ran);
+ ctx.run();
+ ASIO_CHECK(ran);
+}
+
+} // namespace coro
+
+ASIO_TEST_SUITE
+(
+ "coro/partial",
+ ASIO_TEST_CASE(::coro::partial)
+)