diff options
author | Spencer T Brody <spencer@mongodb.com> | 2020-07-17 15:28:57 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-07-27 19:11:12 +0000 |
commit | 738a31e2e7bd7c64f154cedbb2f330151be57788 (patch) | |
tree | a0103d3a29283206db1c2701055cd327e3bf5ffd /src/mongo/util/future_test_shared_future.cpp | |
parent | 31d19d194bf1831cbdb7fab8505b53e6c561b2b2 (diff) | |
download | mongo-738a31e2e7bd7c64f154cedbb2f330151be57788.tar.gz |
SERVER-49702 Add way to explicitly fork SharedSemiFuture continuation chain
Diffstat (limited to 'src/mongo/util/future_test_shared_future.cpp')
-rw-r--r-- | src/mongo/util/future_test_shared_future.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mongo/util/future_test_shared_future.cpp b/src/mongo/util/future_test_shared_future.cpp index 1a17fd994c1..e2740860d2e 100644 --- a/src/mongo/util/future_test_shared_future.cpp +++ b/src/mongo/util/future_test_shared_future.cpp @@ -239,7 +239,7 @@ TEST(SharedFuture, ThenChaining_Async_DoubleShare) { }); } -TEST(SharedFuture, AddChild_Get) { +TEST(SharedFuture, AddChild_ThenRunOn_Get) { FUTURE_SUCCESS_TEST([] {}, [](/*Future<void>*/ auto&& fut) { const auto exec = InlineCountingExecutor::make(); @@ -250,6 +250,16 @@ TEST(SharedFuture, AddChild_Get) { }); } +TEST(SharedFuture, AddChild_Split_Get) { + FUTURE_SUCCESS_TEST([] { return 1; }, + [](/*Future<void>*/ auto&& fut) { + auto shared = std::move(fut).share(); + auto shared2 = shared.split(); + ASSERT_EQ(shared.get(), 1); + ASSERT_EQ(shared2.get(), 1); + }); +} + TEST(SharedFuture, InterruptedGet_AddChild_Get) { FUTURE_SUCCESS_TEST([] {}, [](/*Future<void>*/ auto&& fut) { |