Keep the Unit test suite free of Promise and Future
[folly.git] / folly / futures / test / UnitTest.cpp
index 9eb74dc55e679a78cdc2d4674befb08dce52e8ad..ba372fbb8d321c3686811d93ee0bc08051752ae4 100644 (file)
 
 #include <gtest/gtest.h>
 
-#include <folly/futures/Future.h>
 #include <folly/futures/Unit.h>
 
 using namespace folly;
 
-std::runtime_error eggs("eggs");
-
-TEST(Unit, futureDefaultCtor) {
-  Future<Unit>();
-}
-
 TEST(Unit, operatorEq) {
   EXPECT_TRUE(Unit{} == Unit{});
 }
@@ -35,11 +28,6 @@ TEST(Unit, operatorNe) {
   EXPECT_FALSE(Unit{} != Unit{});
 }
 
-TEST(Unit, promiseSetValue) {
-  Promise<Unit> p;
-  p.setValue();
-}
-
 TEST(Unit, liftInt) {
   using lifted = Unit::Lift<int>;
   using actual = std::is_same<int, lifted::type>;
@@ -75,35 +63,3 @@ TEST(Unit, dropVoid) {
   using actual = std::is_same<void, dropped::type>;
   EXPECT_TRUE(actual::value);
 }
-
-TEST(Unit, futureToUnit) {
-  Future<Unit> fu = makeFuture(42).unit();
-  fu.value();
-  EXPECT_TRUE(makeFuture<int>(eggs).unit().hasException());
-}
-
-TEST(Unit, voidFutureToUnit) {
-  Future<Unit> fu = makeFuture().unit();
-  fu.value();
-  EXPECT_TRUE(makeFuture<Unit>(eggs).unit().hasException());
-}
-
-TEST(Unit, unitFutureToUnitIdentity) {
-  Future<Unit> fu = makeFuture(Unit{}).unit();
-  fu.value();
-  EXPECT_TRUE(makeFuture<Unit>(eggs).unit().hasException());
-}
-
-TEST(Unit, toUnitWhileInProgress) {
-  Promise<int> p;
-  Future<Unit> fu = p.getFuture().unit();
-  EXPECT_FALSE(fu.isReady());
-  p.setValue(42);
-  EXPECT_TRUE(fu.isReady());
-}
-
-TEST(Unit, makeFutureWith) {
-  int count = 0;
-  Future<Unit> fu = makeFutureWith([&]{ count++; });
-  EXPECT_EQ(1, count);
-}