MCPcopy Create free account
hub / github.com/3rdparty/libprocess / AwaitAssertAbandoned

Function AwaitAssertAbandoned

include/process/gtest.hpp:186–214  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

184
185template <typename T>
186::testing::AssertionResult AwaitAssertAbandoned(
187 const char* expr,
188 const char*, // Unused string representation of 'duration'.
189 const process::Future<T>& actual,
190 const Duration& duration)
191{
192 process::Owned<process::Latch> latch(new process::Latch());
193
194 actual.onAny([=]() { latch->trigger(); });
195 actual.onAbandoned([=]() { latch->trigger(); });
196
197 if (!latch->await(duration)) {
198 return ::testing::AssertionFailure()
199 << "Failed to wait " << duration << " for " << expr;
200 } else if (actual.isDiscarded()) {
201 return ::testing::AssertionFailure()
202 << expr << " was discarded";
203 } else if (actual.isReady()) {
204 return ::testing::AssertionFailure()
205 << expr << " is ready (" << ::testing::PrintToString(actual.get()) << ")";
206 } else if (actual.isFailed()) {
207 return ::testing::AssertionFailure()
208 << "(" << expr << ").failure(): " << actual.failure();
209 }
210
211 CHECK_ABANDONED(actual);
212
213 return ::testing::AssertionSuccess();
214}
215
216
217template <typename T1, typename T2>

Callers

nothing calls this directly

Calls 6

triggerMethod · 0.80
isDiscardedMethod · 0.80
isReadyMethod · 0.80
isFailedMethod · 0.80
awaitMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected