Skip to content

Commit

Permalink
Fix test for just sender
Browse files Browse the repository at this point in the history
  • Loading branch information
maikel committed Jan 8, 2025
1 parent 0587b8f commit d05077e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
10 changes: 7 additions & 3 deletions include/beman/execution26/detail/get_completion_behaviour.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,16 @@ struct get_completion_behaviour_t {

if constexpr (requires { typename new_sender_type::completion_behaviour; }) {
return typename new_sender_type::completion_behaviour{};
} else if constexpr (requires { ::std::move(new_sender).get_completion_behaviour(std::forward<Env>(env)); }) {
return std::move(new_sender).get_completion_behaviour(std::forward<Env>(env));
} else if constexpr (requires {
new_sender(::std::forward<Sender>(sender), ::std::forward<Env>(env))
.get_completion_behaviour(std::forward<Env>(env));
}) {
return new_sender(::std::forward<Sender>(sender), ::std::forward<Env>(env))
.get_completion_behaviour(std::forward<Env>(env));
} else if constexpr (::beman::execution26::detail::is_awaitable<
new_sender_type,
::beman::execution26::detail::env_promise<decayed_env>>) {
if (new_sender(sender, env).await_ready()) {
if (new_sender(::std::forward<Sender>(sender), ::std::forward<Env>(env)).await_ready()) {
return completion_behaviour::inline_completion;
} else {
return completion_behaviour::unknown;
Expand Down
2 changes: 1 addition & 1 deletion include/beman/execution26/detail/just.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct impls_for<just_t<Completion>> : ::beman::execution26::detail::default_imp
}(::std::make_index_sequence<State::size()>{});
};

static constexpr auto get_completion_behaviour = [](const auto&, const auto&, const auto&) {
static constexpr auto get_completion_behaviour = [](const auto&, const auto&, const auto&...) {
return ::beman::execution26::completion_behaviour::inline_completion;
};
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

#include <beman/execution26/detail/get_completion_behaviour.hpp>
#include <beman/execution26/detail/just.hpp>

#include <test/execution.hpp>

Expand Down Expand Up @@ -44,10 +45,17 @@ void test_constexpr_sender() {
ASSERT(test_std::completion_behaviour::inline_completion == completion_behaviour);
}

void test_just() {
auto just = test_std::just();
auto completion_behaviour = test_std::get_completion_behaviour(just, test_std::empty_env{});
ASSERT(test_std::completion_behaviour::inline_completion == completion_behaviour);
}

} // namespace

TEST(exec_get_completion_behaviour) {
test_constexpr_awaitable();
test_typedef_sender();
test_constexpr_sender();
test_just();
}

0 comments on commit d05077e

Please sign in to comment.