// // Copyright (c) 2019 Vinnie Falco (vinnie.falco@gmail.com) // Copyright (c) 2022 Alan de Freitas (alandefreitas@gmail.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/url // #include #include #include #include #include #include "test_suite.hpp" namespace boost { namespace urls { struct natvis_test { struct yesexcept { int id; yesexcept() : id([] { static int id_ = 0; return ++id_; }()) { } yesexcept(yesexcept&& u) { id = u.id; } yesexcept(yesexcept const& u) { id = u.id; } yesexcept& operator=(yesexcept&& u) { id = u.id; return *this; } yesexcept& operator=(yesexcept const& u) { id = u.id; return *this; } }; struct my_category : error_category { my_category() noexcept : error_category(0xabadfadeadeadfad) { } const char* name() const noexcept override { return "boost.url.natvis"; } std::string message(int) const override { return {}; } error_condition default_error_condition( int ev) const noexcept override { return {ev, *this}; } }; // these are here to view the results of // .natvis definitions in the debugger. void run() { // boost::assert::source_location { static auto loc = BOOST_CURRENT_LOCATION; ignore_unused(loc); } // boost::variant2::variant { } // boost::system::error_category { auto const& c1 = boost::system::generic_category(); auto const& c2 = boost::system::system_category(); auto const& c3 = error_code(std::error_code()).category(); auto const& c4 = my_category(); auto const& c5 = error_code(error::not_a_base).category(); ignore_unused(c1, c2, c3, c4, c5); } // boost::system::error_code { static auto loc = BOOST_CURRENT_LOCATION; auto const e0 = error_code(); auto const e1 = error_code(std::make_error_code(std::errc::address_in_use)); auto const e2 = error_code(error::success); auto const e3a = error_code(error::not_a_base); auto const e3b = error_code(make_error_code(errc::bad_address)); auto const e4 = error_code(error_code(error::success), &loc); auto const e5 = error_code(error_code(error::not_a_base), &loc); ignore_unused(e0, e1, e2, e3a, e3b, e4, e5); } // boost::system::result { result rv1; result rv2 = 3.14; result rv3 = error::not_a_base; result rv4; result rv5 = yesexcept{}; result rv6 = error::not_a_base; ignore_unused(rv1, rv2, rv3, rv4, rv5, rv6); } // boost::core::string_view { string_view s1; string_view s2 = "This is how we do it"; string_view s3 = s2.substr(8, 3); ignore_unused(s1, s2, s3); } } }; TEST_SUITE( natvis_test, "boost.url.natvis"); } // urls } // boost