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

Future::then to Future::thenValue in ThreadedExecutorTest

Summary: Future::then to Future::thenValue to remove calls to deprecated functions.

Reviewed By: Orvid

Differential Revision: D10346695

fbshipit-source-id: 7f9641ef5b7f93ac4376a52724d42502eb1703b9
parent eb5a6416
......@@ -29,8 +29,8 @@ class ThreadedExecutorTest : public testing::Test {};
TEST_F(ThreadedExecutorTest, example) {
folly::ThreadedExecutor x;
auto ret = folly::via(&x)
.then([&] { return 42; })
.then([&](int n) { return folly::to<std::string>(n); })
.thenValue([&](auto&&) { return 42; })
.thenValue([&](int n) { return folly::to<std::string>(n); })
.get();
EXPECT_EQ("42", ret);
......@@ -54,9 +54,9 @@ TEST_F(ThreadedExecutorTest, many) {
folly::collect(
folly::gen::range<size_t>(0, kNumTasks) |
folly::gen::map([&](size_t i) {
return folly::via(&x).then([=] { return i; }).then([](size_t k) {
return folly::to<std::string>(k);
});
return folly::via(&x)
.thenValue([=](auto&&) { return i; })
.thenValue([](size_t k) { return folly::to<std::string>(k); });
}) |
folly::gen::as<std::vector>())
.get();
......@@ -73,11 +73,11 @@ TEST_F(ThreadedExecutorTest, many_sleeping_constant_time) {
folly::gen::range<size_t>(0, kNumTasks) |
folly::gen::map([&](size_t i) {
return folly::via(&x)
.then([=] {
.thenValue([=](auto&&) {
/* sleep override */ std::this_thread::sleep_for(kDelay);
})
.then([=] { return i; })
.then([](size_t k) { return folly::to<std::string>(k); });
.thenValue([=](auto&&) { return i; })
.thenValue([](size_t k) { return folly::to<std::string>(k); });
}) |
folly::gen::as<std::vector>())
.get();
......@@ -94,12 +94,12 @@ TEST_F(ThreadedExecutorTest, many_sleeping_decreasing_time) {
folly::gen::range<size_t>(0, kNumTasks) |
folly::gen::map([&](size_t i) {
return folly::via(&x)
.then([=] {
.thenValue([=](auto&&) {
auto delay = kDelay * (kNumTasks - i) / kNumTasks;
/* sleep override */ std::this_thread::sleep_for(delay);
})
.then([=] { return i; })
.then([](size_t k) { return folly::to<std::string>(k); });
.thenValue([=](auto&&) { return i; })
.thenValue([](size_t k) { return folly::to<std::string>(k); });
}) |
folly::gen::as<std::vector>())
.get();
......
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