MCPcopy Create free account
hub / github.com/Snapchat/Valdi / TEST

Function TEST

valdi/test/runtime/Future_tests.cpp:6–17  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4namespace Valdi::test {
5
6TEST(Future, notifiesThenOnComplete) {
7 TypedPromise<int> promise;
8 auto future = promise.getFuture();
9 Result<int> outResult;
10 future.then([&](Result<int> result) { outResult = result; });
11
12 ASSERT_TRUE(outResult.empty()) << outResult.description();
13 promise.setValue(1);
14 ASSERT_FALSE(outResult.empty()) << outResult.description();
15 ASSERT_TRUE(outResult.success()) << outResult.description();
16 ASSERT_EQ(1, outResult.value());
17}
18
19TEST(Future, notifiesThenOnError) {
20 TypedPromise<int> promise;

Callers

nothing calls this directly

Calls 13

descriptionMethod · 0.80
getFutureMethod · 0.65
thenMethod · 0.65
valueMethod · 0.65
toStringMethod · 0.65
errorMethod · 0.65
ErrorInterface · 0.50
emptyMethod · 0.45
setValueMethod · 0.45
successMethod · 0.45
setErrorMethod · 0.45
failureMethod · 0.45

Tested by

no test coverage detected