From: Kefu Chai Date: Fri, 11 Dec 2020 13:58:14 +0000 (+0800) Subject: test/crimson: add a test to verify that errorator does not copy X-Git-Tag: v16.1.0~278^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=953efae652eb07a19ac5b5d48dcda03022bda0e0;p=ceph.git test/crimson: add a test to verify that errorator does not copy Signed-off-by: Kefu Chai --- diff --git a/src/test/crimson/test_errorator.cc b/src/test/crimson/test_errorator.cc index b6285c67f856..57dbc78cf999 100644 --- a/src/test/crimson/test_errorator.cc +++ b/src/test/crimson/test_errorator.cc @@ -18,6 +18,23 @@ struct errorator_test_t : public seastar_test_suite_t { } }); } + struct noncopyable_t { + constexpr noncopyable_t() = default; + ~noncopyable_t() = default; + noncopyable_t(noncopyable_t&&) = default; + private: + noncopyable_t(const noncopyable_t&) = delete; + noncopyable_t& operator=(const noncopyable_t&) = delete; + }; + ertr::future<> test_non_copy_then() { + return create_noncopyable().safe_then([](auto t) { + return ertr::now(); + }); + } +private: + ertr::future create_noncopyable() { + return ertr::make_ready_future(); + } }; TEST_F(errorator_test_t, basic) @@ -26,3 +43,10 @@ TEST_F(errorator_test_t, basic) test_do_until().unsafe_get0(); }); } + +TEST_F(errorator_test_t, non_copy_then) +{ + run_async([this] { + test_non_copy_then().unsafe_get0(); + }); +}