1+ #include " condy/async_operations.hpp"
12#include " condy/awaiter_operations.hpp"
23#include " condy/channel.hpp"
34#include " condy/detail/async_operations.hpp"
67#include " condy/sync_wait.hpp"
78#include < atomic>
89#include < cassert>
10+ #include < cerrno>
911#include < doctest.h>
12+ #include < optional>
1013#include < stdexcept>
1114#include < stop_token>
1215#include < thread>
@@ -557,4 +560,46 @@ TEST_CASE("test senders - cancel from other runtime thread") {
557560 condy::sync_wait (cancel_task ());
558561
559562 t1.join ();
560- }
563+ }
564+
565+ TEST_CASE (" test senders - start without runtime" ) {
566+ auto coro = []() -> condy::Coro<int > {
567+ int r = co_await condy::async_nop ();
568+ REQUIRE (r == -EINVAL );
569+ co_return r;
570+ }();
571+ auto handle = coro.release ();
572+
573+ REQUIRE (!handle.done ());
574+ handle.resume ();
575+ REQUIRE (handle.done ());
576+ REQUIRE (handle.promise ().value () == -EINVAL );
577+
578+ handle.destroy ();
579+ }
580+
581+ #if CONDY_URING_VERSION_GE(2, 13) // >= 2.13
582+ TEST_CASE (" test senders - start without sqe128 support" ) {
583+ auto func = []() -> condy::Coro<void > {
584+ int r = co_await condy::async_nop128 ();
585+ REQUIRE (r == -EINVAL );
586+ };
587+ condy::sync_wait (func ());
588+ }
589+ #endif
590+
591+ TEST_CASE (" test senders - start with stopped token" ) {
592+ using condy::operators::operator ||;
593+
594+ auto func = []() -> condy::Coro<void > {
595+ condy::Channel<int > ch (1 );
596+ REQUIRE (ch.try_push (42 ) == 0 );
597+
598+ auto res = co_await (ch.pop () || condy::async_nop ());
599+ REQUIRE (res.index () == 0 );
600+ auto [r, item] = std::get<0 >(res);
601+ REQUIRE (r == 0 );
602+ REQUIRE (item == 42 );
603+ };
604+ condy::sync_wait (func ());
605+ }
0 commit comments