Commit d3d1f745 authored by Lee Howes's avatar Lee Howes Committed by Facebook Github Bot

Remove nullary then from tests.

Summary:
Remove falls to Future::then that take a nullary lambda. This is deprecated and will be deleted.

This change replaces them with thenValue([](auto&&){...}) or similar.

This does not replace all calls to then with thenValue - other forms will be replaced when those forms of then are due for deletion.

Reviewed By: yfeldblum

Differential Revision: D10219070

fbshipit-source-id: 13b6f64ee2d7c8741537fe1131bdf3b251361413
parent 86a13ee9
......@@ -60,7 +60,7 @@ class CallbackLifetimeTest : public testing::Test {
});
}
static void raise() {
static void raise(folly::Unit = folly::Unit{}) {
if (kRaiseWillThrow()) { // to avoid marking [[noreturn]]
throw std::runtime_error("raise");
}
......@@ -76,32 +76,36 @@ class CallbackLifetimeTest : public testing::Test {
TEST_F(CallbackLifetimeTest, thenReturnsValue) {
auto c = mkC();
via(&executor).then([_ = mkCGuard(c)] {}).wait();
via(&executor).thenValue([_ = mkCGuard(c)](auto&&) {}).wait();
EXPECT_EQ(1, *c);
}
TEST_F(CallbackLifetimeTest, thenReturnsValueThrows) {
auto c = mkC();
via(&executor).then([_ = mkCGuard(c)] { raise(); }).wait();
via(&executor).thenValue([_ = mkCGuard(c)](auto&&) { raise(); }).wait();
EXPECT_EQ(1, *c);
}
TEST_F(CallbackLifetimeTest, thenReturnsFuture) {
auto c = mkC();
via(&executor).then([_ = mkCGuard(c)] { return makeFuture(); }).wait();
via(&executor)
.thenValue([_ = mkCGuard(c)](auto&&) { return makeFuture(); })
.wait();
EXPECT_EQ(1, *c);
}
TEST_F(CallbackLifetimeTest, thenReturnsFutureThrows) {
auto c = mkC();
via(&executor).then([_ = mkCGuard(c)] { return raiseFut(); }).wait();
via(&executor)
.thenValue([_ = mkCGuard(c)](auto&&) { return raiseFut(); })
.wait();
EXPECT_EQ(1, *c);
}
TEST_F(CallbackLifetimeTest, onErrorTakesExnReturnsValueMatch) {
auto c = mkC();
via(&executor)
.then(raise)
.thenValue(raise)
.onError([_ = mkCGuard(c)](std::exception&) {})
.wait();
EXPECT_EQ(1, *c);
......@@ -110,7 +114,7 @@ TEST_F(CallbackLifetimeTest, onErrorTakesExnReturnsValueMatch) {
TEST_F(CallbackLifetimeTest, onErrorTakesExnReturnsValueMatchThrows) {
auto c = mkC();
via(&executor)
.then(raise)
.thenValue(raise)
.onError([_ = mkCGuard(c)](std::exception&) { raise(); })
.wait();
EXPECT_EQ(1, *c);
......@@ -119,7 +123,7 @@ TEST_F(CallbackLifetimeTest, onErrorTakesExnReturnsValueMatchThrows) {
TEST_F(CallbackLifetimeTest, onErrorTakesExnReturnsValueWrong) {
auto c = mkC();
via(&executor)
.then(raise)
.thenValue(raise)
.onError([_ = mkCGuard(c)](std::logic_error&) {})
.wait();
EXPECT_EQ(1, *c);
......@@ -128,7 +132,7 @@ TEST_F(CallbackLifetimeTest, onErrorTakesExnReturnsValueWrong) {
TEST_F(CallbackLifetimeTest, onErrorTakesExnReturnsValueWrongThrows) {
auto c = mkC();
via(&executor)
.then(raise)
.thenValue(raise)
.onError([_ = mkCGuard(c)](std::logic_error&) { raise(); })
.wait();
EXPECT_EQ(1, *c);
......@@ -137,7 +141,7 @@ TEST_F(CallbackLifetimeTest, onErrorTakesExnReturnsValueWrongThrows) {
TEST_F(CallbackLifetimeTest, onErrorTakesExnReturnsFutureMatch) {
auto c = mkC();
via(&executor)
.then(raise)
.thenValue(raise)
.onError([_ = mkCGuard(c)](std::exception&) { return makeFuture(); })
.wait();
EXPECT_EQ(1, *c);
......@@ -146,7 +150,7 @@ TEST_F(CallbackLifetimeTest, onErrorTakesExnReturnsFutureMatch) {
TEST_F(CallbackLifetimeTest, onErrorTakesExnReturnsFutureMatchThrows) {
auto c = mkC();
via(&executor)
.then(raise)
.thenValue(raise)
.onError([_ = mkCGuard(c)](std::exception&) { return raiseFut(); })
.wait();
EXPECT_EQ(1, *c);
......@@ -155,7 +159,7 @@ TEST_F(CallbackLifetimeTest, onErrorTakesExnReturnsFutureMatchThrows) {
TEST_F(CallbackLifetimeTest, onErrorTakesExnReturnsFutureWrong) {
auto c = mkC();
via(&executor)
.then(raise)
.thenValue(raise)
.onError([_ = mkCGuard(c)](std::logic_error&) { return makeFuture(); })
.wait();
EXPECT_EQ(1, *c);
......@@ -164,7 +168,7 @@ TEST_F(CallbackLifetimeTest, onErrorTakesExnReturnsFutureWrong) {
TEST_F(CallbackLifetimeTest, onErrorTakesExnReturnsFutureWrongThrows) {
auto c = mkC();
via(&executor)
.then(raise)
.thenValue(raise)
.onError([_ = mkCGuard(c)](std::logic_error&) { return raiseFut(); })
.wait();
EXPECT_EQ(1, *c);
......@@ -173,7 +177,7 @@ TEST_F(CallbackLifetimeTest, onErrorTakesExnReturnsFutureWrongThrows) {
TEST_F(CallbackLifetimeTest, onErrorTakesWrapReturnsValue) {
auto c = mkC();
via(&executor)
.then(raise)
.thenValue(raise)
.onError([_ = mkCGuard(c)](exception_wrapper&&) {})
.wait();
EXPECT_EQ(1, *c);
......@@ -182,7 +186,7 @@ TEST_F(CallbackLifetimeTest, onErrorTakesWrapReturnsValue) {
TEST_F(CallbackLifetimeTest, onErrorTakesWrapReturnsValueThrows) {
auto c = mkC();
via(&executor)
.then(raise)
.thenValue(raise)
.onError([_ = mkCGuard(c)](exception_wrapper&&) { raise(); })
.wait();
EXPECT_EQ(1, *c);
......@@ -191,7 +195,7 @@ TEST_F(CallbackLifetimeTest, onErrorTakesWrapReturnsValueThrows) {
TEST_F(CallbackLifetimeTest, onErrorTakesWrapReturnsFuture) {
auto c = mkC();
via(&executor)
.then(raise)
.thenValue(raise)
.onError([_ = mkCGuard(c)](exception_wrapper&&) { return makeFuture(); })
.wait();
EXPECT_EQ(1, *c);
......@@ -200,7 +204,7 @@ TEST_F(CallbackLifetimeTest, onErrorTakesWrapReturnsFuture) {
TEST_F(CallbackLifetimeTest, onErrorTakesWrapReturnsFutureThrows) {
auto c = mkC();
via(&executor)
.then(raise)
.thenValue(raise)
.onError([_ = mkCGuard(c)](exception_wrapper&&) { return raiseFut(); })
.wait();
EXPECT_EQ(1, *c);
......
......@@ -44,7 +44,7 @@ TEST(Context, basic) {
// Start a future
Promise<Unit> p;
auto future = p.getFuture().then([&] {
auto future = p.getFuture().thenValue([&](auto&&) {
// Check that the context followed the future
EXPECT_TRUE(RequestContext::get() != nullptr);
auto a =
......
......@@ -39,9 +39,9 @@ TEST(Ensure, mutableLambda) {
set->insert(1);
set->insert(2);
auto f = makeFuture(4).ensure([set]() mutable { set->clear(); }).then([]() {
throw std::runtime_error("ensure");
});
auto f = makeFuture(4)
.ensure([set]() mutable { set->clear(); })
.thenValue([](auto&&) { throw std::runtime_error("ensure"); });
EXPECT_EQ(0, set->size());
EXPECT_THROW(std::move(f).get(), std::runtime_error);
......
This diff is collapsed.
......@@ -23,8 +23,10 @@ TEST(NonCopyableLambda, basic) {
Promise<int> promise;
Future<int> future = promise.getFuture();
Future<Unit>().then(std::bind(
[](Promise<int>& p2) mutable { p2.setValue(123); }, std::move(promise)));
Future<Unit>().thenValue(std::bind(
[](Promise<int>& p2, folly::Unit) mutable { p2.setValue(123); },
std::move(promise),
std::placeholders::_1));
// The previous statement can be simplified in C++14:
// Future<Unit>().then([promise = std::move(promise)]() mutable {
......@@ -41,12 +43,13 @@ TEST(NonCopyableLambda, unique_ptr) {
EXPECT_EQ(*int_ptr, 1);
auto future = promise.getFuture().then(std::bind(
[](std::unique_ptr<int>& p) mutable {
auto future = promise.getFuture().thenValue(std::bind(
[](std::unique_ptr<int>& p, folly::Unit) mutable {
++*p;
return std::move(p);
},
std::move(int_ptr)));
std::move(int_ptr),
std::placeholders::_1));
// The previous statement can be simplified in C++14:
// auto future =
......
......@@ -106,9 +106,11 @@ TEST(RetryingTest, policy_throws) {
TEST(RetryingTest, policy_future) {
atomic<size_t> sleeps{0};
auto r = futures::retrying(
auto r =
futures::retrying(
[&](size_t n, const exception_wrapper&) {
return n < 3 ? makeFuture(++sleeps).then([] { return true; })
return n < 3
? makeFuture(++sleeps).thenValue([](auto&&) { return true; })
: makeFuture(false);
},
[](size_t n) {
......@@ -209,7 +211,7 @@ TEST(RetryingTest, large_retries) {
// size of implicit promise is at least the size of the return.
using LargeReturn = array<uint64_t, 16000>;
auto func = [&executor](size_t retryNum) -> Future<LargeReturn> {
return via(&executor).then([retryNum] {
return via(&executor).thenValue([retryNum](auto&&) {
return retryNum < 10000
? makeFuture<LargeReturn>(
make_exception_wrapper<std::runtime_error>("keep trying"))
......@@ -221,7 +223,7 @@ TEST(RetryingTest, large_retries) {
for (auto idx = 0; idx < 40; ++idx) {
futures.emplace_back(futures::retrying(
[&executor](size_t, const exception_wrapper&) {
return via(&executor).then([] { return true; });
return via(&executor).thenValue([](auto&&) { return true; });
},
func));
}
......
......@@ -67,7 +67,7 @@ TEST(SelfDestruct, throwingInlineExecutor) {
auto* p = new Promise<int>();
auto future = p->getFuture()
.via(&executor)
.then([p]() -> int {
.thenValue([p](auto &&) -> int {
delete p;
throw ThrowingExecutorError("callback throws");
})
......
......@@ -632,7 +632,7 @@ TEST(SemiFuture, ChainingDefertoThen) {
auto f = p.getSemiFuture().toUnsafeFuture();
auto sf = std::move(f).semi().defer([&](auto&&) { innerResult = 17; });
// Run "F" here inline in a task running on the eventbase
auto tf = std::move(sf).via(&e2).then([&]() { result = 42; });
auto tf = std::move(sf).via(&e2).thenValue([&](auto&&) { result = 42; });
p.setValue();
tf.getVia(&e2);
ASSERT_EQ(innerResult, 17);
......
......@@ -40,7 +40,6 @@ TEST(Basic, thenVariants) {
{Future<B> f = someFuture<A>().then(aStdFunction<Future<B>, A>());}
{Future<B> f = someFuture<A>().then([&](A){return someFuture<B>();});}
{Future<B> f = someFuture<A>().then(&SomeClass::aMethod<Future<B>, A&>, &anObject);}
{Future<B> f = someFuture<A>().then([&](){return someFuture<B>();});}
{Future<B> f = someFuture<A>().then(&aFunction<B, Try<A>&&>);}
{Future<B> f = someFuture<A>().then(&SomeClass::aStaticMethod<B, Try<A>&&>);}
{Future<B> f = someFuture<A>().then(&SomeClass::aMethod<B, Try<A>&&>, &anObject);}
......@@ -73,6 +72,5 @@ TEST(Basic, thenVariants) {
{Future<B> f = someFuture<A>().then(aStdFunction<B, A>());}
{Future<B> f = someFuture<A>().then([&](A){return B();});}
{Future<B> f = someFuture<A>().then(&SomeClass::aMethod<B, A&>, &anObject);}
{Future<B> f = someFuture<A>().then([&](){return B();});}
// clang-format on
}
......@@ -179,7 +179,7 @@ TEST(Then, constValue) {
TEST(Then, objectAliveDuringImmediateNoParamContinuation) {
auto f = makeFuture<CountedWidget>(23);
auto called = false;
std::move(f).then([&] {
std::move(f).thenValue([&](auto&&) {
EXPECT_EQ(CountedWidget::instances_.size(), 1u);
EXPECT_EQ(CountedWidget::instances_[0]->v_, 23);
called = true;
......@@ -190,7 +190,7 @@ TEST(Then, objectAliveDuringImmediateNoParamContinuation) {
TEST(Then, objectAliveDuringDeferredNoParamContinuation) {
auto p = Promise<CountedWidget>{};
bool called = false;
p.getFuture().then([&] {
p.getFuture().thenValue([&](auto&&) {
EXPECT_EQ(CountedWidget::instances_.size(), 1u);
EXPECT_EQ(CountedWidget::instances_[0]->v_, 23);
called = true;
......
......@@ -109,8 +109,10 @@ TEST(Timekeeper, semiFutureWithinHandlesNullTimekeeperSingleton) {
TEST(Timekeeper, futureDelayed) {
auto t1 = now();
auto dur =
makeFuture().delayed(one_ms).then([=] { return now() - t1; }).get();
auto dur = makeFuture()
.delayed(one_ms)
.thenValue([=](auto&&) { return now() - t1; })
.get();
EXPECT_GE(dur, one_ms);
}
......@@ -120,7 +122,7 @@ TEST(Timekeeper, semiFutureDelayed) {
auto dur = makeSemiFuture()
.delayed(one_ms)
.toUnsafeFuture()
.then([=] { return now() - t1; })
.thenValue([=](auto&&) { return now() - t1; })
.get();
EXPECT_GE(dur, one_ms);
......@@ -128,8 +130,10 @@ TEST(Timekeeper, semiFutureDelayed) {
TEST(Timekeeper, futureDelayedUnsafe) {
auto t1 = now();
auto dur =
makeFuture().delayedUnsafe(one_ms).then([=] { return now() - t1; }).get();
auto dur = makeFuture()
.delayedUnsafe(one_ms)
.thenValue([=](auto&&) { return now() - t1; })
.get();
EXPECT_GE(dur, one_ms);
}
......@@ -149,7 +153,7 @@ TEST(Timekeeper, futureDelayedStickyExecutor) {
std::thread::id task_thread_id{};
auto dur = makeFuture()
.delayed(one_ms, &tk)
.then([=, &task_thread_id] {
.thenValue([=, &task_thread_id](auto&&) {
task_thread_id = std::this_thread::get_id();
return now() - t1;
})
......@@ -176,11 +180,11 @@ TEST(Timekeeper, futureDelayedStickyExecutor) {
}};
auto dur = makeSemiFuture()
.via(&me)
.then([&first_task_thread_id] {
.thenValue([&first_task_thread_id](auto&&) {
first_task_thread_id = std::this_thread::get_id();
})
.delayed(one_ms)
.then([=, &second_task_thread_id] {
.thenValue([=, &second_task_thread_id](auto&&) {
second_task_thread_id = std::this_thread::get_id();
return now() - t1;
})
......@@ -320,7 +324,8 @@ TEST(Timekeeper, interruptDoesntCrash) {
TEST(Timekeeper, chainedInterruptTest) {
bool test = false;
auto f = futures::sleep(milliseconds(100)).then([&]() { test = true; });
auto f =
futures::sleep(milliseconds(100)).thenValue([&](auto&&) { test = true; });
f.cancel();
f.wait();
EXPECT_FALSE(test);
......@@ -368,7 +373,7 @@ TEST(Timekeeper, executor) {
Promise<Unit> p;
ExecutorTester tester;
auto f = p.getFuture().via(&tester).within(one_ms).then([&]() {});
auto f = p.getFuture().via(&tester).within(one_ms).thenValue([&](auto&&) {});
p.setValue();
f.wait();
EXPECT_EQ(2, tester.count);
......
......@@ -67,7 +67,7 @@ TEST(Times, success) {
auto thunk = makeThunk(ps, interrupt, ps_mutex);
auto f = folly::times(3, thunk)
.then([&]() mutable { complete = true; })
.thenValue([&](auto&&) mutable { complete = true; })
.onError([&](FutureException& /* e */) { failure = true; });
popAndFulfillPromise(ps, ps_mutex);
......@@ -93,7 +93,7 @@ TEST(Times, failure) {
auto thunk = makeThunk(ps, interrupt, ps_mutex);
auto f = folly::times(3, thunk)
.then([&]() mutable { complete = true; })
.thenValue([&](auto&&) mutable { complete = true; })
.onError([&](FutureException& /* e */) { failure = true; });
popAndFulfillPromise(ps, ps_mutex);
......@@ -121,7 +121,7 @@ TEST(Times, interrupt) {
auto thunk = makeThunk(ps, interrupt, ps_mutex);
auto f = folly::times(3, thunk)
.then([&]() mutable { complete = true; })
.thenValue([&](auto&&) mutable { complete = true; })
.onError([&](FutureException& /* e */) { failure = true; });
EXPECT_EQ(0, interrupt);
......
......@@ -132,7 +132,7 @@ TEST_F(ViaFixture, threadHops) {
TEST_F(ViaFixture, chainVias) {
auto westThreadId = std::this_thread::get_id();
auto f = via(eastExecutor.get())
.then([=]() {
.thenValue([=](auto&&) {
EXPECT_NE(std::this_thread::get_id(), westThreadId);
return 1;
})
......@@ -224,14 +224,15 @@ struct PriorityExecutor : public Executor {
TEST(Via, priority) {
PriorityExecutor exe;
via(&exe, -1).then([] {});
via(&exe, 0).then([] {});
via(&exe, 1).then([] {});
via(&exe, 42).then([] {}); // overflow should go to max priority
via(&exe, -42).then([] {}); // underflow should go to min priority
via(&exe).then([] {}); // default to mid priority
via(&exe, Executor::LO_PRI).then([] {});
via(&exe, Executor::HI_PRI).then([] {});
via(&exe, -1).thenValue([](auto&&) {});
via(&exe, 0).thenValue([](auto&&) {});
via(&exe, 1).thenValue([](auto&&) {});
via(&exe, 42).thenValue([](auto&&) {}); // overflow should go to max priority
via(&exe, -42).thenValue(
[](auto&&) {}); // underflow should go to min priority
via(&exe).thenValue([](auto&&) {}); // default to mid priority
via(&exe, Executor::LO_PRI).thenValue([](auto&&) {});
via(&exe, Executor::HI_PRI).thenValue([](auto&&) {});
EXPECT_EQ(3, exe.count0);
EXPECT_EQ(2, exe.count1);
EXPECT_EQ(3, exe.count2);
......@@ -261,7 +262,7 @@ TEST_F(ViaFixture, chainX3) {
return std::string("hello");
},
[&] { count++; })
.then([&]() {
.thenValue([&](auto&&) {
EXPECT_EQ(std::this_thread::get_id(), westThreadId);
return makeFuture(42);
});
......@@ -272,9 +273,10 @@ TEST_F(ViaFixture, chainX3) {
TEST(Via, then2) {
ManualExecutor x1, x2;
bool a = false, b = false, c = false;
via(&x1).then([&] { a = true; }).then(&x2, [&] { b = true; }).then([&] {
c = true;
});
via(&x1)
.thenValue([&](auto&&) { a = true; })
.then(&x2, [&](auto&&) { b = true; })
.thenValue([&](auto&&) { c = true; });
EXPECT_FALSE(a);
EXPECT_FALSE(b);
......@@ -349,7 +351,9 @@ class ThreadExecutor : public Executor {
TEST(Via, viaThenGetWasRacy) {
ThreadExecutor x;
std::unique_ptr<int> val =
folly::via(&x).then([] { return std::make_unique<int>(42); }).get();
folly::via(&x)
.thenValue([](auto&&) { return std::make_unique<int>(42); })
.get();
ASSERT_TRUE(!!val);
EXPECT_EQ(42, *val);
}
......@@ -392,7 +396,7 @@ TEST(Via, getVia) {
{
// non-void
ManualExecutor x;
auto f = via(&x).then([] { return true; });
auto f = via(&x).thenValue([](auto&&) { return true; });
EXPECT_TRUE(f.getVia(&x));
}
......@@ -422,7 +426,7 @@ TEST(Via, getTryVia) {
{
// non-void
ManualExecutor x;
auto f = via(&x).then([] { return 23; });
auto f = via(&x).thenValue([](auto&&) { return 23; });
EXPECT_FALSE(f.isReady());
EXPECT_EQ(23, f.getTryVia(&x).value());
}
......@@ -506,8 +510,8 @@ TEST(Via, viaDummyExecutorFutureSetValueFirst) {
auto captured_promise_future = captured_promise.getFuture();
DummyDrivableExecutor x;
auto future = makeFuture().via(&x).then(
[c = std::move(captured_promise)] { return 42; });
auto future = makeFuture().via(&x).thenValue(
[c = std::move(captured_promise)](auto&&) { return 42; });
EXPECT_THROW(std::move(future).get(std::chrono::seconds(5)), BrokenPromise);
EXPECT_THROW(
......@@ -525,8 +529,8 @@ TEST(Via, viaDummyExecutorFutureSetCallbackFirst) {
DummyDrivableExecutor x;
Promise<Unit> trigger;
auto future = trigger.getFuture().via(&x).then(
[c = std::move(captured_promise)] { return 42; });
auto future = trigger.getFuture().via(&x).thenValue(
[c = std::move(captured_promise)](auto&&) { return 42; });
trigger.setValue();
EXPECT_THROW(std::move(future).get(std::chrono::seconds(5)), BrokenPromise);
......@@ -547,8 +551,8 @@ TEST(Via, viaExecutorDiscardsTaskFutureSetValueFirst) {
Optional<Future<int>> future;
{
ManualExecutor x;
future = makeFuture().via(&x).then(
[c = std::move(captured_promise)] { return 42; });
future = makeFuture().via(&x).thenValue(
[c = std::move(captured_promise)](auto&&) { return 42; });
x.clear();
}
......@@ -571,8 +575,8 @@ TEST(Via, viaExecutorDiscardsTaskFutureSetCallbackFirst) {
{
ManualExecutor x;
Promise<Unit> trigger;
future = trigger.getFuture().via(&x).then(
[c = std::move(captured_promise)] { return 42; });
future = trigger.getFuture().via(&x).thenValue(
[c = std::move(captured_promise)](auto&&) { return 42; });
trigger.setValue();
x.clear();
}
......@@ -629,7 +633,7 @@ TEST(ViaFunc, isSticky) {
auto f = via(&x, [&] { count++; });
x.run();
std::move(f).then([&] { count++; });
std::move(f).thenValue([&](auto&&) { count++; });
EXPECT_EQ(1, count);
x.run();
EXPECT_EQ(2, count);
......@@ -649,5 +653,9 @@ TEST(ViaFunc, valueKeepAlive) {
TEST(ViaFunc, thenValueKeepAlive) {
ManualExecutor x;
EXPECT_EQ(42, via(getKeepAliveToken(&x)).then([] { return 42; }).getVia(&x));
EXPECT_EQ(
42,
via(getKeepAliveToken(&x))
.thenValue([](auto&&) { return 42; })
.getVia(&x));
}
......@@ -24,7 +24,7 @@ using namespace folly;
TEST(When, predicateFalse) {
int i = 0;
auto thunk = [&] { return makeFuture().then([&] { i += 1; }); };
auto thunk = [&] { return makeFuture().thenValue([&](auto&&) { i += 1; }); };
// false
auto f1 = folly::when(false, thunk);
......@@ -34,7 +34,7 @@ TEST(When, predicateFalse) {
TEST(When, predicateTrue) {
int i = 0;
auto thunk = [&] { return makeFuture().then([&] { i += 1; }); };
auto thunk = [&] { return makeFuture().thenValue([&](auto&&) { i += 1; }); };
// true
auto f2 = folly::when(true, thunk);
......
......@@ -69,7 +69,7 @@ TEST(WhileDo, success) {
auto pred = makePred(i);
auto thunk = makeThunk(ps, interrupt, ps_mutex);
auto f = folly::whileDo(pred, thunk)
.then([&]() mutable { complete = true; })
.thenValue([&](auto&&) mutable { complete = true; })
.onError([&](FutureException& /* e */) { failure = true; });
popAndFulfillPromise(ps, ps_mutex);
......@@ -97,7 +97,7 @@ TEST(WhileDo, failure) {
auto pred = makePred(i);
auto thunk = makeThunk(ps, interrupt, ps_mutex);
auto f = folly::whileDo(pred, thunk)
.then([&]() mutable { complete = true; })
.thenValue([&](auto&&) mutable { complete = true; })
.onError([&](FutureException& /* e */) { failure = true; });
popAndFulfillPromise(ps, ps_mutex);
......@@ -127,7 +127,7 @@ TEST(WhileDo, interrupt) {
auto pred = makePred(i);
auto thunk = makeThunk(ps, interrupt, ps_mutex);
auto f = folly::whileDo(pred, thunk)
.then([&]() mutable { complete = true; })
.thenValue([&](auto&&) mutable { complete = true; })
.onError([&](FutureException& /* e */) { failure = true; });
EXPECT_EQ(0, interrupt);
......
......@@ -39,7 +39,6 @@ param_types = [
"A const&",
"A",
"A&",
"",
]
tests = (
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment