From 6d9680905acc8a7ba3812eddf02f2d69f3172e3f Mon Sep 17 00:00:00 2001 From: Denis Blank Date: Sat, 18 Mar 2017 02:10:14 +0100 Subject: [PATCH] Add a promise mock --- include/continuable/continuable-base.hpp | 2 +- test/mock/test-mock.cpp | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/include/continuable/continuable-base.hpp b/include/continuable/continuable-base.hpp index 61d88d7..cdffc46 100644 --- a/include/continuable/continuable-base.hpp +++ b/include/continuable/continuable-base.hpp @@ -1334,7 +1334,7 @@ constexpr auto common_result_of(Signature signature, signature_hint_tag<>, /// Determine the common result between all continuation which are chained /// with an `any` strategy, consider two continuations: -/// c1 with `void(int)` and c22 with `void(float)`, the common result shared +/// c1 with `void(int)` and c2 with `void(float)`, the common result shared /// between both continuations is `void(int)`. template constexpr auto common_result_of(Signature signature, First first, diff --git a/test/mock/test-mock.cpp b/test/mock/test-mock.cpp index b8e89ad..b7d7563 100644 --- a/test/mock/test-mock.cpp +++ b/test/mock/test-mock.cpp @@ -55,6 +55,22 @@ template struct promise { bool is_canceled() const noexcept { return false; } }; +template struct promise { + void set_value(T...) noexcept {} + + void operator()(T...) && noexcept {} + + void set_exception(std::exception_ptr exception) noexcept { + // ... + (void)exception; + } + + void set_error(std::error_code error) noexcept { + // ... + (void)error; + } +}; + template struct accumulator { auto accumulate() { return [] {};