From 953efae652eb07a19ac5b5d48dcda03022bda0e0 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Fri, 11 Dec 2020 21:58:14 +0800 Subject: [PATCH] test/crimson: add a test to verify that errorator does not copy Signed-off-by: Kefu Chai --- src/test/crimson/test_errorator.cc | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/test/crimson/test_errorator.cc b/src/test/crimson/test_errorator.cc index b6285c67f8568..57dbc78cf9993 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(); + }); +} -- 2.47.3