]>
git.proxmox.com Git - ceph.git/blob - ceph/src/test/crimson/test_errorator.cc
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:nil -*-
2 // vim: ts=8 sw=2 smarttab
4 #include "test/crimson/gtest_seastar.h"
6 #include "crimson/common/errorator.h"
7 #include "crimson/common/log.h"
9 struct errorator_test_t
: public seastar_test_suite_t
{
10 using ertr
= crimson::errorator
<crimson::ct_error::invarg
>;
11 ertr::future
<> test_do_until() {
12 return crimson::do_until([i
=0]() mutable {
15 return ertr::make_ready_future
<bool>(false);
17 return ertr::make_ready_future
<bool>(true);
21 struct noncopyable_t
{
22 constexpr noncopyable_t() = default;
23 ~noncopyable_t() = default;
24 noncopyable_t(noncopyable_t
&&) = default;
26 noncopyable_t(const noncopyable_t
&) = delete;
27 noncopyable_t
& operator=(const noncopyable_t
&) = delete;
29 ertr::future
<> test_non_copy_then() {
30 return create_noncopyable().safe_then([](auto t
) {
35 ertr::future
<noncopyable_t
> create_noncopyable() {
36 return ertr::make_ready_future
<noncopyable_t
>();
40 TEST_F(errorator_test_t
, basic
)
43 test_do_until().unsafe_get0();
47 TEST_F(errorator_test_t
, non_copy_then
)
50 test_non_copy_then().unsafe_get0();