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 testing {
|
||||
template <typename C> void expect_async_completion(C&& continuable) {
|
||||
bool called = false;
|
||||
std::forward<C>(continuable).then([&](auto&&... args) {
|
||||
ASSERT_FALSE(called);
|
||||
called = true;
|
||||
auto called = std::make_shared<bool>(false);
|
||||
std::forward<C>(continuable).then([called](auto&&... args) {
|
||||
ASSERT_FALSE(*called);
|
||||
*called = true;
|
||||
|
||||
// Workaround for our known GCC bug.
|
||||
util::unused(std::forward<decltype(args)>(args)...);
|
||||
|
||||
@ -58,21 +58,36 @@ template <typename T> auto assert_invocation(T* me) {
|
||||
[](auto&& /*callback*/) mutable { FAIL(); });
|
||||
}
|
||||
|
||||
TYPED_TEST(single_dimension_tests, are_incomplete_when_released) {
|
||||
auto chain = this->supply();
|
||||
chain.release();
|
||||
EXPECT_ASYNC_INCOMPLETE(std::move(chain));
|
||||
TYPED_TEST(single_dimension_tests, are_incomplete_when_frozen) {
|
||||
{
|
||||
auto chain = this->supply();
|
||||
chain.freeze();
|
||||
EXPECT_ASYNC_INCOMPLETE(std::move(chain));
|
||||
}
|
||||
|
||||
{
|
||||
auto chain = this->supply();
|
||||
chain.freeze();
|
||||
EXPECT_ASYNC_INCOMPLETE(std::move(chain).then(this->supply()));
|
||||
}
|
||||
}
|
||||
|
||||
TYPED_TEST(single_dimension_tests, are_not_dispatched_when_released) {
|
||||
TYPED_TEST(single_dimension_tests, are_not_dispatched_when_frozen) {
|
||||
auto chain = assert_invocation(this);
|
||||
chain.release();
|
||||
chain.freeze();
|
||||
EXPECT_ASYNC_INCOMPLETE(std::move(chain));
|
||||
}
|
||||
|
||||
TYPED_TEST(single_dimension_tests, are_not_finished_when_not_continued) {
|
||||
auto chain = create_incomplete(this);
|
||||
EXPECT_ASYNC_INCOMPLETE(std::move(chain));
|
||||
{
|
||||
auto chain = create_incomplete(this);
|
||||
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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user