proxygen
|
#include <folly/futures/Future.h>
#include <folly/Executor.h>
#include <folly/Memory.h>
#include <folly/Unit.h>
#include <folly/dynamic.h>
#include <folly/executors/ManualExecutor.h>
#include <folly/portability/GTest.h>
#include <folly/synchronization/Baton.h>
#include <algorithm>
#include <atomic>
#include <memory>
#include <numeric>
#include <queue>
#include <string>
#include <thread>
#include <type_traits>
Go to the source code of this file.
Macros | |
#define | EXPECT_TYPE(x, T) EXPECT_TRUE((std::is_same<decltype(x), T>::value)) |
#define | DOIT(CREATION_EXPR) |
#define | DOIT(CREATION_EXPR) |
#define | DOIT(STMT) |
#define | DOIT(STMT) |
#define | DOIT(STMT) |
#define | DOIT(CTOR, STMT) |
#define | EXPECT_FLAG() |
#define | EXPECT_NO_FLAG() |
#define | EXPECT_FLAG() |
#define | EXPECT_NO_FLAG() |
Typedefs | |
typedef FutureException | eggs_t |
Functions | |
TEST (Future, makeEmpty) | |
TEST (Future, futureDefaultCtor) | |
TEST (Future, futureToUnit) | |
TEST (Future, voidFutureToUnit) | |
TEST (Future, unitFutureToUnitIdentity) | |
TEST (Future, toUnitWhileInProgress) | |
TEST (Future, makeFutureWithUnit) | |
TEST (Future, getRequiresOnlyMoveCtor) | |
TEST (Future, ctorPostconditionValid) | |
TEST (Future, ctorPostconditionInvalid) | |
TEST (Future, lacksPreconditionValid) | |
TEST (Future, hasPreconditionValid) | |
TEST (Future, hasPostconditionValid) | |
TEST (Future, hasPostconditionInvalid) | |
TEST (Future, onError) | |
TEST (Future, thenError) | |
TEST (Future, special) | |
TEST (Future, then) | |
static folly::Future< std::string > | doWorkStaticTry (Try< std::string > &&t) |
TEST (Future, thenTrythenValue) | |
TEST (Future, thenTry) | |
TEST (Future, thenValue) | |
TEST (Future, thenValueFuture) | |
static std::string | doWorkStatic (Try< std::string > &&t) |
static std::string | doWorkStaticValue (std::string &&t) |
TEST (Future, thenFunction) | |
static Future< std::string > | doWorkStaticFuture (Try< std::string > &&t) |
TEST (Future, thenFunctionFuture) | |
TEST (Future, thenStdFunction) | |
TEST (Future, thenBind) | |
TEST (Future, thenBindTry) | |
TEST (Future, value) | |
TEST (Future, isReady) | |
TEST (Future, futureNotReady) | |
TEST (Future, hasException) | |
TEST (Future, hasValue) | |
TEST (Future, makeFuture) | |
TEST (Future, finish) | |
TEST (Future, finishBigLambda) | |
TEST (Future, unwrap) | |
TEST (Future, throwCaughtInImmediateThen) | |
TEST (Future, throwIfFailed) | |
TEST (Future, getFutureAfterSetValue) | |
TEST (Future, getFutureAfterSetException) | |
TEST (Future, detachRace) | |
TEST (Future, CircularDependencySharedPtrSelfReset) | |
TEST (Future, Constructor) | |
TEST (Future, ImplicitConstructor) | |
TEST (Future, InPlaceConstructor) | |
TEST (Future, thenDynamic) | |
TEST (Future, RequestContext) | |
TEST (Future, makeFutureNoThrow) | |
TEST (Future, invokeCallbackReturningValueAsRvalue) | |
TEST (Future, invokeCallbackReturningFutureAsRvalue) | |
TEST (Future, futureWithinCtxCleanedUpWhenTaskFinishedInTime) | |
TEST (Future, futureWithinNoValueReferenceWhenTimeOut) | |
TEST (Future, makePromiseContract) | |
Future< bool > | call (int depth, Executor *executor) |
Future< int > | recursion (Executor *executor, int depth) |
TEST (Future, ThenRecursion) | |
Variables | |
static eggs_t | eggs ("eggs") |
#define DOIT | ( | CREATION_EXPR | ) |
Referenced by TEST().
#define DOIT | ( | CREATION_EXPR | ) |
#define DOIT | ( | STMT | ) |
#define DOIT | ( | STMT | ) |
#define DOIT | ( | STMT | ) |
#define DOIT | ( | CTOR, | |
STMT | |||
) |
#define EXPECT_FLAG | ( | ) |
Referenced by TEST().
#define EXPECT_FLAG | ( | ) |
#define EXPECT_NO_FLAG | ( | ) |
Referenced by TEST().
#define EXPECT_NO_FLAG | ( | ) |
Definition at line 37 of file FutureTest.cpp.
Referenced by TEST().
typedef FutureException eggs_t |
Definition at line 39 of file FutureTest.cpp.
Definition at line 1606 of file FutureTest.cpp.
References folly::makeFuture().
Referenced by TestFilterOddDeleteDo::doA(), testing::gmock_generated_function_mockers_test::MockOverloadedOnConstness::MockOverloadedOnConstness(), proxygen::FilterChain< HTTPCodec, HTTPCodec::Callback, PassThroughHTTPCodecFilter,&HTTPCodec::setCallback, true >::operator->(), recursion(), and testing::gmock_generated_function_mockers_test::TEST().
|
static |
Definition at line 1066 of file FutureTest.cpp.
References folly::pushmi::detail::t.
Referenced by TEST().
|
static |
Definition at line 1094 of file FutureTest.cpp.
References folly::makeFuture(), and folly::pushmi::detail::t.
Referenced by TEST().
|
static |
Definition at line 956 of file FutureTest.cpp.
References folly::makeFuture(), and folly::pushmi::detail::t.
Referenced by TEST().
|
static |
Definition at line 1070 of file FutureTest.cpp.
References folly::pushmi::detail::t.
Referenced by TEST().
Definition at line 1610 of file FutureTest.cpp.
References call(), and folly::makeFuture().
Referenced by TEST().
TEST | ( | Future | , |
makeEmpty | |||
) |
Definition at line 44 of file FutureTest.cpp.
References EXPECT_THROW, f, and folly::Future< T >::makeEmpty().
TEST | ( | Future | , |
futureDefaultCtor | |||
) |
Definition at line 49 of file FutureTest.cpp.
TEST | ( | Future | , |
futureToUnit | |||
) |
Definition at line 53 of file FutureTest.cpp.
References eggs, EXPECT_TRUE, folly::makeFuture(), folly::unit, and folly::futures::detail::FutureBase< T >::value().
TEST | ( | Future | , |
voidFutureToUnit | |||
) |
Definition at line 59 of file FutureTest.cpp.
References eggs, EXPECT_TRUE, folly::makeFuture(), folly::unit, and folly::futures::detail::FutureBase< T >::value().
TEST | ( | Future | , |
unitFutureToUnitIdentity | |||
) |
Definition at line 65 of file FutureTest.cpp.
References eggs, EXPECT_TRUE, folly::makeFuture(), folly::unit, and folly::futures::detail::FutureBase< T >::value().
TEST | ( | Future | , |
toUnitWhileInProgress | |||
) |
Definition at line 71 of file FutureTest.cpp.
References EXPECT_FALSE, EXPECT_TRUE, folly::Promise< T >::getFuture(), folly::futures::detail::FutureBase< T >::isReady(), and folly::Promise< T >::setValue().
TEST | ( | Future | , |
makeFutureWithUnit | |||
) |
Definition at line 79 of file FutureTest.cpp.
References count, EXPECT_EQ, and folly::makeFutureWith().
TEST | ( | Future | , |
getRequiresOnlyMoveCtor | |||
) |
Definition at line 85 of file FutureTest.cpp.
References EXPECT_EQ, EXPECT_FALSE, EXPECT_TRUE, f, folly::Future< T >::makeEmpty(), and folly::gen::move.
TEST | ( | Future | , |
ctorPostconditionValid | |||
) |
Definition at line 137 of file FutureTest.cpp.
References DOIT, and folly::makeFuture().
TEST | ( | Future | , |
ctorPostconditionInvalid | |||
) |
Definition at line 171 of file FutureTest.cpp.
References DOIT.
TEST | ( | Future | , |
lacksPreconditionValid | |||
) |
Definition at line 189 of file FutureTest.cpp.
References folly::copy(), DOIT, f, and folly::gen::move.
TEST | ( | Future | , |
hasPreconditionValid | |||
) |
Definition at line 222 of file FutureTest.cpp.
References DOIT, f, and folly::gen::move.
TEST | ( | Future | , |
hasPostconditionValid | |||
) |
Definition at line 249 of file FutureTest.cpp.
References DOIT, f, and folly::gen::move.
TEST | ( | Future | , |
hasPostconditionInvalid | |||
) |
Definition at line 277 of file FutureTest.cpp.
References DOIT, f, folly::makeFuture(), folly::gen::move, and folly::detail::distributed_mutex::wait().
TEST | ( | Future | , |
onError | |||
) |
Definition at line 342 of file FutureTest.cpp.
References eggs, EXPECT_EQ, EXPECT_FLAG, EXPECT_NO_FLAG, EXPECT_NO_THROW, EXPECT_THROW, f, flag, and folly::makeFuture().
TEST | ( | Future | , |
thenError | |||
) |
Definition at line 640 of file FutureTest.cpp.
References eggs, EXPECT_EQ, EXPECT_FLAG, EXPECT_NO_FLAG, EXPECT_NO_THROW, EXPECT_THROW, f, flag, and folly::makeFuture().
TEST | ( | Future | , |
special | |||
) |
Definition at line 925 of file FutureTest.cpp.
References EXPECT_FALSE, EXPECT_TRUE, and folly::value().
TEST | ( | Future | , |
then | |||
) |
Definition at line 932 of file FutureTest.cpp.
References EXPECT_EQ, f, folly::makeFuture(), s, string, folly::pushmi::detail::t, and folly::Try< T >::value().
TEST | ( | Future | , |
thenTrythenValue | |||
) |
Definition at line 960 of file FutureTest.cpp.
References doWorkStaticTry(), EXPECT_EQ, f, folly::makeFuture(), s, string, folly::pushmi::detail::t, and folly::Try< T >::value().
TEST | ( | Future | , |
thenTry | |||
) |
Definition at line 986 of file FutureTest.cpp.
References EXPECT_EQ, EXPECT_FALSE, EXPECT_TRUE, f, flag, folly::Promise< T >::getFuture(), folly::makeFuture(), folly::Promise< T >::setValue(), and folly::pushmi::detail::t.
TEST | ( | Future | , |
thenValue | |||
) |
Definition at line 1021 of file FutureTest.cpp.
References eggs, EXPECT_EQ, EXPECT_THROW, EXPECT_TRUE, f, flag, i, and folly::makeFuture().
TEST | ( | Future | , |
thenValueFuture | |||
) |
Definition at line 1048 of file FutureTest.cpp.
References EXPECT_EQ, EXPECT_TRUE, flag, i, folly::makeFuture(), folly::gen::move, and folly::pushmi::detail::t.
TEST | ( | Future | , |
thenFunction | |||
) |
Definition at line 1074 of file FutureTest.cpp.
References doWork(), doWorkStatic(), doWorkStaticValue(), EXPECT_EQ, f, string, and folly::pushmi::detail::t.
TEST | ( | Future | , |
thenFunctionFuture | |||
) |
Definition at line 1098 of file FutureTest.cpp.
References doWorkStaticFuture(), EXPECT_EQ, f, folly::makeFuture(), and folly::pushmi::detail::t.
TEST | ( | Future | , |
thenStdFunction | |||
) |
Definition at line 1116 of file FutureTest.cpp.
References EXPECT_EQ, EXPECT_TRUE, f, flag, i, folly::makeFuture(), folly::gen::move, folly::pushmi::detail::t, and folly::Try< T >::value().
TEST | ( | Future | , |
thenBind | |||
) |
Definition at line 1146 of file FutureTest.cpp.
References b, folly::netops::bind(), EXPECT_EQ, f, folly::makeFuture(), and folly::gen::move.
TEST | ( | Future | , |
thenBindTry | |||
) |
Definition at line 1153 of file FutureTest.cpp.
References b, folly::netops::bind(), EXPECT_EQ, f, folly::makeFuture(), folly::gen::move, and folly::pushmi::detail::t.
Definition at line 1161 of file FutureTest.cpp.
References eggs, EXPECT_EQ, EXPECT_THROW, f, folly::makeFuture(), folly::gen::move, and folly::value().
TEST | ( | Future | , |
isReady | |||
) |
Definition at line 1169 of file FutureTest.cpp.
References EXPECT_FALSE, EXPECT_TRUE, f, folly::Promise< T >::getFuture(), and folly::Promise< T >::setValue().
TEST | ( | Future | , |
futureNotReady | |||
) |
Definition at line 1177 of file FutureTest.cpp.
References EXPECT_THROW, f, folly::Promise< T >::getFuture(), and folly::futures::detail::FutureBase< T >::value().
TEST | ( | Future | , |
hasException | |||
) |
Definition at line 1183 of file FutureTest.cpp.
References eggs, EXPECT_FALSE, EXPECT_TRUE, and folly::makeFuture().
TEST | ( | Future | , |
hasValue | |||
) |
Definition at line 1188 of file FutureTest.cpp.
References eggs, EXPECT_FALSE, EXPECT_TRUE, and folly::makeFuture().
TEST | ( | Future | , |
makeFuture | |||
) |
Definition at line 1193 of file FutureTest.cpp.
References eggs, EXPECT_EQ, EXPECT_NO_THROW, EXPECT_THROW, EXPECT_TYPE, fun(), folly::makeFuture(), folly::makeFutureWith(), and folly::value().
TEST | ( | Future | , |
finish | |||
) |
Definition at line 1221 of file FutureTest.cpp.
References EXPECT_EQ, f, and folly::pushmi::detail::t.
TEST | ( | Future | , |
finishBigLambda | |||
) |
Definition at line 1243 of file FutureTest.cpp.
References EXPECT_EQ, f, folly::Promise< T >::getFuture(), folly::Promise< T >::setValue(), and folly::pushmi::detail::t.
TEST | ( | Future | , |
unwrap | |||
) |
Definition at line 1276 of file FutureTest.cpp.
References a, b, EXPECT_EQ, EXPECT_FALSE, EXPECT_TRUE, f, folly::Promise< T >::getFuture(), folly::futures::detail::FutureBase< T >::isReady(), folly::gen::move, folly::Promise< T >::setValue(), and folly::futures::detail::FutureBase< T >::value().
TEST | ( | Future | , |
throwCaughtInImmediateThen | |||
) |
Definition at line 1311 of file FutureTest.cpp.
References folly::makeFuture().
TEST | ( | Future | , |
throwIfFailed | |||
) |
Definition at line 1318 of file FutureTest.cpp.
References eggs, EXPECT_NO_THROW, EXPECT_THROW, folly::makeFuture(), and folly::pushmi::detail::t.
TEST | ( | Future | , |
getFutureAfterSetValue | |||
) |
Definition at line 1329 of file FutureTest.cpp.
References EXPECT_EQ, folly::Promise< T >::getFuture(), and folly::Promise< T >::setValue().
TEST | ( | Future | , |
getFutureAfterSetException | |||
) |
Definition at line 1335 of file FutureTest.cpp.
References EXPECT_THROW, folly::Promise< T >::getFuture(), and folly::Promise< T >::setWith().
TEST | ( | Future | , |
detachRace | |||
) |
Definition at line 1341 of file FutureTest.cpp.
References f, and folly::Baton< MayBlock, Atom >::wait().
TEST | ( | Future | , |
CircularDependencySharedPtrSelfReset | |||
) |
Definition at line 1367 of file FutureTest.cpp.
References EXPECT_EQ, folly::Promise< T >::getFuture(), folly::gen::move, ptr, and folly::Promise< T >::setValue().
TEST | ( | Future | , |
Constructor | |||
) |
Definition at line 1386 of file FutureTest.cpp.
References EXPECT_EQ, EXPECT_NO_THROW, and folly::futures::detail::FutureBase< T >::value().
TEST | ( | Future | , |
ImplicitConstructor | |||
) |
Definition at line 1393 of file FutureTest.cpp.
References EXPECT_EQ.
TEST | ( | Future | , |
InPlaceConstructor | |||
) |
Definition at line 1401 of file FutureTest.cpp.
References EXPECT_EQ, f, and folly::in_place().
TEST | ( | Future | , |
thenDynamic | |||
) |
Definition at line 1406 of file FutureTest.cpp.
References folly::dynamic::asInt(), EXPECT_EQ, f, folly::Promise< T >::getFuture(), folly::gen::move, and folly::Promise< T >::setValue().
TEST | ( | Future | , |
RequestContext | |||
) |
Definition at line 1417 of file FutureTest.cpp.
References add, EXPECT_FALSE, EXPECT_TRUE, f, for_each(), folly::RequestContext::get(), folly::RequestContext::getContextData(), folly::Promise< T >::getFuture(), int8_t, folly::makeFuture(), folly::gen::move, folly::RequestContext::saveContext(), folly::RequestContext::setContextData(), folly::Promise< T >::setValue(), folly::pushmi::detail::t, uint8_t, and folly::value().
TEST | ( | Future | , |
makeFutureNoThrow | |||
) |
Definition at line 1489 of file FutureTest.cpp.
References folly::makeFuture().
TEST | ( | Future | , |
invokeCallbackReturningValueAsRvalue | |||
) |
Definition at line 1493 of file FutureTest.cpp.
References EXPECT_EQ, folly::foo, and folly::value().
TEST | ( | Future | , |
invokeCallbackReturningFutureAsRvalue | |||
) |
Definition at line 1517 of file FutureTest.cpp.
References EXPECT_EQ, folly::foo, and folly::value().
TEST | ( | Future | , |
futureWithinCtxCleanedUpWhenTaskFinishedInTime | |||
) |
Definition at line 1545 of file FutureTest.cpp.
References EXPECT_EQ, folly::Promise< T >::getFuture(), and folly::Promise< T >::setValue().
TEST | ( | Future | , |
futureWithinNoValueReferenceWhenTimeOut | |||
) |
Definition at line 1566 of file FutureTest.cpp.
References EXPECT_EQ, and folly::Promise< T >::getFuture().
TEST | ( | Future | , |
makePromiseContract | |||
) |
Definition at line 1577 of file FutureTest.cpp.
References testing::_, add, ASSERT_TRUE, c, folly::ManualExecutor::drain(), EXPECT_EQ, EXPECT_FALSE, f, and folly::gen::move.
TEST | ( | Future | , |
ThenRecursion | |||
) |
Definition at line 1622 of file FutureTest.cpp.
References folly::pushmi::executor, EXPECT_EQ, and recursion().