mirror of
https://github.com/Naios/continuable.git
synced 2025-12-06 16:56:44 +08:00
Store the result of expect completion tests on the heap
This commit is contained in:
parent
05b611ce78
commit
bf4335d602
@ -42,10 +42,10 @@ inline namespace abi_v1 {
|
|||||||
namespace detail {
|
namespace detail {
|
||||||
namespace testing {
|
namespace testing {
|
||||||
template <typename C> void expect_async_completion(C&& continuable) {
|
template <typename C> void expect_async_completion(C&& continuable) {
|
||||||
bool called = false;
|
auto called = std::make_shared<bool>(false);
|
||||||
std::forward<C>(continuable).then([&](auto&&... args) {
|
std::forward<C>(continuable).then([called](auto&&... args) {
|
||||||
ASSERT_FALSE(called);
|
ASSERT_FALSE(*called);
|
||||||
called = true;
|
*called = true;
|
||||||
|
|
||||||
// Workaround for our known GCC bug.
|
// Workaround for our known GCC bug.
|
||||||
util::unused(std::forward<decltype(args)>(args)...);
|
util::unused(std::forward<decltype(args)>(args)...);
|
||||||
|
|||||||
@ -58,23 +58,38 @@ template <typename T> auto assert_invocation(T* me) {
|
|||||||
[](auto&& /*callback*/) mutable { FAIL(); });
|
[](auto&& /*callback*/) mutable { FAIL(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
TYPED_TEST(single_dimension_tests, are_incomplete_when_released) {
|
TYPED_TEST(single_dimension_tests, are_incomplete_when_frozen) {
|
||||||
|
{
|
||||||
auto chain = this->supply();
|
auto chain = this->supply();
|
||||||
chain.release();
|
chain.freeze();
|
||||||
EXPECT_ASYNC_INCOMPLETE(std::move(chain));
|
EXPECT_ASYNC_INCOMPLETE(std::move(chain));
|
||||||
}
|
}
|
||||||
|
|
||||||
TYPED_TEST(single_dimension_tests, are_not_dispatched_when_released) {
|
{
|
||||||
|
auto chain = this->supply();
|
||||||
|
chain.freeze();
|
||||||
|
EXPECT_ASYNC_INCOMPLETE(std::move(chain).then(this->supply()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TYPED_TEST(single_dimension_tests, are_not_dispatched_when_frozen) {
|
||||||
auto chain = assert_invocation(this);
|
auto chain = assert_invocation(this);
|
||||||
chain.release();
|
chain.freeze();
|
||||||
EXPECT_ASYNC_INCOMPLETE(std::move(chain));
|
EXPECT_ASYNC_INCOMPLETE(std::move(chain));
|
||||||
}
|
}
|
||||||
|
|
||||||
TYPED_TEST(single_dimension_tests, are_not_finished_when_not_continued) {
|
TYPED_TEST(single_dimension_tests, are_not_finished_when_not_continued) {
|
||||||
|
{
|
||||||
auto chain = create_incomplete(this);
|
auto chain = create_incomplete(this);
|
||||||
EXPECT_ASYNC_INCOMPLETE(std::move(chain));
|
EXPECT_ASYNC_INCOMPLETE(std::move(chain));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto chain = create_incomplete(this);
|
||||||
|
EXPECT_ASYNC_INCOMPLETE(std::move(chain).then(this->supply()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TYPED_TEST(single_dimension_tests, are_chainable) {
|
TYPED_TEST(single_dimension_tests, are_chainable) {
|
||||||
EXPECT_ASYNC_RESULT(this->supply().then([] {
|
EXPECT_ASYNC_RESULT(this->supply().then([] {
|
||||||
return; // void
|
return; // void
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user