Add continuation to semifuture return test.
authorLee Howes <lwh@fb.com>
Wed, 27 Dec 2017 18:07:40 +0000 (10:07 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 27 Dec 2017 18:25:53 +0000 (10:25 -0800)
Summary: Add more detail to testing return of SemiFuture from a continuation to ensure correct behaviour.

Reviewed By: yfeldblum

Differential Revision: D6637565

fbshipit-source-id: 096a7ca140e6bdef7baab6725e86d25cf79742d8

folly/futures/test/SemiFutureTest.cpp

index c51a6fe9d458f800528479921f4fe99bfc3b2954..ce24b4e734f0d43a20fd6c0bd0edd285098b7a3a 100644 (file)
@@ -226,10 +226,15 @@ TEST(SemiFuture, MakeFutureFromSemiFutureReturnSemiFuture) {
   Promise<int> p;
   int result{0};
   auto f = p.getSemiFuture();
-  auto future = std::move(f).via(&e).then([&](int value) {
-    result = value;
-    return folly::makeSemiFuture(std::move(value));
-  });
+  auto future = std::move(f)
+                    .via(&e)
+                    .then([&](int value) {
+                      result = value;
+                      return folly::makeSemiFuture(std::move(value));
+                    })
+                    .then([&](int value) {
+                      return folly::makeSemiFuture(std::move(value));
+                    });
   e.loop();
   EXPECT_EQ(result, 0);
   EXPECT_FALSE(future.isReady());