From 43fcbd7f245f681d0e863f40bd57687cc4229a81 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Thu, 7 Mar 2019 12:55:41 -0800 Subject: [PATCH] Remove deprecated handler_ptr tests --- test/beast/core/CMakeLists.txt | 1 - test/beast/core/Jamfile | 1 - test/beast/core/handler_ptr.cpp | 130 -------------------------------- 3 files changed, 132 deletions(-) delete mode 100644 test/beast/core/handler_ptr.cpp diff --git a/test/beast/core/CMakeLists.txt b/test/beast/core/CMakeLists.txt index d76d54ef..f6aba25d 100644 --- a/test/beast/core/CMakeLists.txt +++ b/test/beast/core/CMakeLists.txt @@ -54,7 +54,6 @@ add_executable (tests-beast-core flat_buffer.cpp flat_static_buffer.cpp flat_stream.cpp - handler_ptr.cpp make_printable.cpp multi_buffer.cpp ostream.cpp diff --git a/test/beast/core/Jamfile b/test/beast/core/Jamfile index 9f61acc4..cb5e295b 100644 --- a/test/beast/core/Jamfile +++ b/test/beast/core/Jamfile @@ -42,7 +42,6 @@ local SOURCES = flat_buffer.cpp flat_static_buffer.cpp flat_stream.cpp - handler_ptr.cpp make_printable.cpp multi_buffer.cpp ostream.cpp diff --git a/test/beast/core/handler_ptr.cpp b/test/beast/core/handler_ptr.cpp deleted file mode 100644 index 7db4cb47..00000000 --- a/test/beast/core/handler_ptr.cpp +++ /dev/null @@ -1,130 +0,0 @@ -// -// Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) -// -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// Official repository: https://github.com/boostorg/beast -// - -#ifdef BOOST_BEAST_ALLOW_DEPRECATED -#undef BOOST_BEAST_ALLOW_DEPRECATED -#define BOOST_BEAST_ALLOW_DEPRECATED 0 -#endif - -// Test that header file is self-contained. -#include - -#include -#include -#include -#include - -namespace boost { -namespace beast { - -class handler_ptr_test : public beast::unit_test::suite -{ -public: - struct handler - { - std::unique_ptr ptr; - void operator()(bool& b) const - { - b = true; - } - }; - - struct T - { - explicit T(handler const&) - { - } - - ~T() - { - } - }; - - void - testCtorExcept() - { - struct U - { - explicit U(handler const&) - { - throw std::exception{}; - } - }; - handler_ptr p1{handler{}}; - try - { - handler_ptr p2{handler{}}; - fail(); - } - catch(std::exception const&) - { - pass(); - } - catch(...) - { - fail("", __FILE__, __LINE__); - } - } - - void - testMoveExcept() - { - struct throwing_handler - { - throwing_handler() = default; - throwing_handler(throwing_handler&&) - { - throw std::bad_alloc{}; - } - void operator()() const - { - } - }; - struct T - { - explicit T(throwing_handler const&) noexcept {} - }; - try - { - throwing_handler h; - handler_ptr p{std::move(h)}; - fail("", __FILE__, __LINE__); - } - catch (std::bad_alloc const&) - { - pass(); - } - } - - void - testInvoke() - { - handler_ptr p{handler{}}; - bool b = false; - BEAST_EXPECT(p.has_value()); - p.invoke(std::ref(b)); - BEAST_EXPECT(! p.has_value()); - BEAST_EXPECT(b); - } - - void - run() override - { - testCtorExcept(); - testMoveExcept(); - testInvoke(); - } -}; - -BEAST_DEFINE_TESTSUITE(beast,core,handler_ptr); - -} // beast -} // boost - -#undef BOOST_BEAST_ALLOW_DEPRECATED