Commit 28aa8674 authored by Lewis Baker's avatar Lewis Baker Committed by Facebook Github Bot

Add test for 'co_await folly::futures::sleep()`

Summary:
Add a test that verifies that the compiler does not issue a
warning/error complaining about a discarded return-value.

Reviewed By: yfeldblum

Differential Revision: D14546568

fbshipit-source-id: 98b479da78b01549b5cec2893fc3e454ba3bb802
parent 1c98e783
......@@ -26,6 +26,7 @@
#include <folly/experimental/coro/SharedMutex.h>
#include <folly/experimental/coro/Task.h>
#include <folly/experimental/coro/detail/InlineTask.h>
#include <folly/futures/helpers.h>
#include <folly/portability/GTest.h>
#include <type_traits>
......@@ -345,4 +346,14 @@ TEST(Task, FutureTailCall) {
})));
}
// NOTE: This function is unused.
// We just want to make sure this compiles without errors or warnings.
folly::coro::Task<void>
checkAwaitingFutureOfUnitDoesntWarnAboutDiscardedResult() {
co_await folly::makeSemiFuture();
using namespace std::literals::chrono_literals;
co_await folly::futures::sleep(1ms);
}
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment