From 26cfd42a33843cb84f0f82ce426ec86bc352f3b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dietmar=20K=C3=BChl?= Date: Thu, 7 Aug 2025 00:23:20 +0100 Subject: [PATCH 1/2] fix completion signatures of scope test sender --- .../beman/execution/detail/scope_token.hpp | 3 +- tests/beman/execution/exec-then.test.cpp | 40 +++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/include/beman/execution/detail/scope_token.hpp b/include/beman/execution/detail/scope_token.hpp index edb98279..d60ab4f1 100644 --- a/include/beman/execution/detail/scope_token.hpp +++ b/include/beman/execution/detail/scope_token.hpp @@ -17,7 +17,8 @@ struct token_test_env {}; struct token_test_sender { using sender_concept = ::beman::execution::sender_t; - auto get_completion_signatures(::beman::execution::detail::token_test_env) const noexcept { + template + auto get_completion_signatures(Env const&...) const noexcept { return ::beman::execution::completion_signatures<>{}; } }; diff --git a/tests/beman/execution/exec-then.test.cpp b/tests/beman/execution/exec-then.test.cpp index cb333c87..07b3f02c 100644 --- a/tests/beman/execution/exec-then.test.cpp +++ b/tests/beman/execution/exec-then.test.cpp @@ -5,6 +5,8 @@ #include #include +#include +#include #include #include #include @@ -22,12 +24,23 @@ struct error { }; struct non_sender {}; +struct get_value_t: test_std::forwarding_query_t { + auto operator()(auto const& e) const noexcept -> int { + return e.query(*this); + } +}; + struct receiver { using receiver_concept = test_std::receiver_t; auto set_error(auto&&) && noexcept -> void {} auto set_stopped() && noexcept -> void {} auto set_value(auto&&...) && noexcept -> void {} + + struct env { + auto query(get_value_t const&) const noexcept { return 42; } + }; + auto get_env() const noexcept { return env{}; } }; template @@ -214,6 +227,31 @@ auto test_then_allocator() -> void { auto state{test_std::connect(std::move(sender), memory_receiver{&resource2})}; ASSERT(resource2.count == 1u); } + +auto test_then_env() -> void { + { + receiver r{}; + auto e{test_std::get_env(r)}; + ASSERT(e.query(get_value_t{}) == 42); + ASSERT(get_value_t{}(e) == 42); + } + { + auto state{test_std::connect(test_std::read_env(get_value_t{}), receiver{})}; + test_std::start(state); + } + { + int value{0}; + auto state{test_std::connect( + test_std::then(test_std::read_env(get_value_t{}), + [&value](int v){ value = v; }), + receiver{}) + }; + ASSERT(value == 0); + test_std::start(state); + ASSERT(value == 42); + } +} + } // namespace TEST(exec_then) { @@ -230,4 +268,6 @@ TEST(exec_then) { test_then_multi_type(); test_then_value(); test_then_allocator(); + + test_then_env(); } From b3437765c12826b9ccb6385548112a6b0cc762f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dietmar=20K=C3=BChl?= Date: Thu, 7 Aug 2025 00:24:31 +0100 Subject: [PATCH 2/2] clang-format --- include/beman/execution/detail/scope_token.hpp | 2 +- tests/beman/execution/exec-then.test.cpp | 17 ++++++----------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/include/beman/execution/detail/scope_token.hpp b/include/beman/execution/detail/scope_token.hpp index d60ab4f1..b0c0984f 100644 --- a/include/beman/execution/detail/scope_token.hpp +++ b/include/beman/execution/detail/scope_token.hpp @@ -18,7 +18,7 @@ struct token_test_env {}; struct token_test_sender { using sender_concept = ::beman::execution::sender_t; template - auto get_completion_signatures(Env const&...) const noexcept { + auto get_completion_signatures(const Env&...) const noexcept { return ::beman::execution::completion_signatures<>{}; } }; diff --git a/tests/beman/execution/exec-then.test.cpp b/tests/beman/execution/exec-then.test.cpp index 07b3f02c..604d7022 100644 --- a/tests/beman/execution/exec-then.test.cpp +++ b/tests/beman/execution/exec-then.test.cpp @@ -24,10 +24,8 @@ struct error { }; struct non_sender {}; -struct get_value_t: test_std::forwarding_query_t { - auto operator()(auto const& e) const noexcept -> int { - return e.query(*this); - } +struct get_value_t : test_std::forwarding_query_t { + auto operator()(const auto& e) const noexcept -> int { return e.query(*this); } }; struct receiver { @@ -38,7 +36,7 @@ struct receiver { auto set_value(auto&&...) && noexcept -> void {} struct env { - auto query(get_value_t const&) const noexcept { return 42; } + auto query(const get_value_t&) const noexcept { return 42; } }; auto get_env() const noexcept { return env{}; } }; @@ -240,12 +238,9 @@ auto test_then_env() -> void { test_std::start(state); } { - int value{0}; - auto state{test_std::connect( - test_std::then(test_std::read_env(get_value_t{}), - [&value](int v){ value = v; }), - receiver{}) - }; + int value{0}; + auto state{test_std::connect(test_std::then(test_std::read_env(get_value_t{}), [&value](int v) { value = v; }), + receiver{})}; ASSERT(value == 0); test_std::start(state); ASSERT(value == 42);