diff --git a/include/asyncpp/stream.hpp b/include/asyncpp/stream.hpp index 3ba7e58..214830f 100644 --- a/include/asyncpp/stream.hpp +++ b/include/asyncpp/stream.hpp @@ -68,6 +68,7 @@ namespace impl_stream { void await_suspend(std::coroutine_handle handle) const noexcept { auto& owner = handle.promise(); assert(owner.m_event); + assert(owner.m_result.has_value()); owner.m_event->set(std::move(owner.m_result)); } diff --git a/include/asyncpp/testing/interleaver.hpp b/include/asyncpp/testing/interleaver.hpp index 65d100a..32d20d8 100644 --- a/include/asyncpp/testing/interleaver.hpp +++ b/include/asyncpp/testing/interleaver.hpp @@ -204,8 +204,5 @@ class interleaver { } // namespace asyncpp::testing -#define INTERLEAVED_RUN(SCENARIO, ...) \ - asyncpp::testing::interleaver({ __VA_ARGS__ }).run() - -#define THREAD(NAME, METHOD) \ - asyncpp::testing::thread_function(NAME, METHOD) \ No newline at end of file +#define INTERLEAVED_RUN(SCENARIO, ...) asyncpp::testing::interleaver({ __VA_ARGS__ }).run() +#define THREAD(NAME, METHOD) asyncpp::testing::thread_function(NAME, METHOD) \ No newline at end of file diff --git a/test/test_stream.cpp b/test/test_stream.cpp index bcc2742..50f84e7 100644 --- a/test/test_stream.cpp +++ b/test/test_stream.cpp @@ -53,7 +53,8 @@ TEST_CASE("Stream: data types", "[Stream]") { }; auto r = []() -> monitor_task { auto s = coro(); - REQUIRE(*(co_await s) == 0); + auto item = co_await s; + REQUIRE(*item == 0); }(); REQUIRE(r.get_counters().done); } @@ -64,7 +65,8 @@ TEST_CASE("Stream: data types", "[Stream]") { }; auto r = []() -> monitor_task { auto s = coro(); - REQUIRE(&*(co_await s) == &value); + auto item = co_await s; + REQUIRE(&*item == &value); }(); REQUIRE(r.get_counters().done); }