fix SharedPromise<T>::setWith
authorJames Sedgwick <jsedgwick@fb.com>
Fri, 4 Sep 2015 21:09:39 +0000 (14:09 -0700)
committerfacebook-github-bot-4 <folly-bot@fb.com>
Fri, 4 Sep 2015 21:20:17 +0000 (14:20 -0700)
Summary: was using the renamed/nonexistent makeTryFunction

Reviewed By: @elliottneilclark

Differential Revision: D2416178

folly/futures/SharedPromise-inl.h
folly/futures/test/SharedPromiseTest.cpp

index 2c09a2a0f2cb71c8531f8cfe4e784f409dd7fef2..c2f6d45428d35e4966e272c0e25ec839486373d4 100644 (file)
@@ -102,7 +102,7 @@ void SharedPromise<T>::setValue(M&& v) {
 template <class T>
 template <class F>
 void SharedPromise<T>::setWith(F&& func) {
-  setTry(makeTryFunction(std::forward<F>(func)));
+  setTry(makeTryWith(std::forward<F>(func)));
 }
 
 template <class T>
index 495526d52ffbbb3f2f94964e0bb830f06b75f61f..77095b1559f8a221e5b5f275b647bd0f7e4795a7 100644 (file)
@@ -100,3 +100,9 @@ TEST(SharedPromise, moveMove) {
   p = std::move(p2);
   p.setValue(std::make_shared<int>(1));
 }
+
+TEST(SharedPromise, setWith) {
+  SharedPromise<int> p;
+  p.setWith([]{ return 1; });
+  EXPECT_EQ(1, p.getFuture().value());
+}