From 0c05aee2b755493c34d89795d6af89c0df8e6b9b Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Thu, 18 Jun 2026 17:18:51 +0200 Subject: [PATCH 1/2] Add support for `std::optional` Output the same as for `boost::optional` and `boost::none_t` --- .../boost/test/tools/detail/print_helper.hpp | 23 +++++++++++++++++++ test/Jamfile.v2 | 2 +- ...sue_475.cpp => cxx17-optional-support.cpp} | 14 +++++++---- 3 files changed, 33 insertions(+), 6 deletions(-) rename test/writing-test-ts/{github_issue_475.cpp => cxx17-optional-support.cpp} (51%) diff --git a/include/boost/test/tools/detail/print_helper.hpp b/include/boost/test/tools/detail/print_helper.hpp index 8c805907ab..0820eef9f4 100644 --- a/include/boost/test/tools/detail/print_helper.hpp +++ b/include/boost/test/tools/detail/print_helper.hpp @@ -34,6 +34,9 @@ #if !defined(BOOST_NO_CXX11_NULLPTR) #include #endif +#if !defined(BOOST_NO_CXX17_HDR_OPTIONAL) +#include +#endif #include @@ -184,6 +187,26 @@ struct print_log_value { //____________________________________________________________________________// +#if !defined(BOOST_NO_CXX17_HDR_OPTIONAL) +template +struct print_log_value> { + void operator()( std::ostream& ostr, std::optional const& t ) { + if( t ) + ostr << ' ' << *t; + else + ostr << "--"; + } +}; +template<> +struct print_log_value { + void operator()( std::ostream& ostr, std::nullopt_t /*t*/ ) { + ostr << "--"; + } +}; +#endif + +//____________________________________________________________________________// + // ************************************************************************** // // ************** print_helper ************** // // ************************************************************************** // diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 9e8ca58a7c..f8399945dd 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -188,7 +188,7 @@ test-suite "writing-test-ts" # [ boost.test-self-test run-fail : writing-test-ts : test-timeout-fail : : : : : : [ requires cxx11_hdr_thread cxx11_hdr_chrono ] ] # [ boost.test-self-test run : writing-test-ts : test-timeout-suite : : : : : : $(requirements_datasets) [ requires cxx11_hdr_thread cxx11_hdr_chrono ] ] # [ boost.test-self-test run-fail : writing-test-ts : test-timeout-suite-fail : : : : : : $(requirements_datasets) [ requires cxx11_hdr_thread cxx11_hdr_chrono ] ] - [ boost.test-self-test run : writing-test-ts : github_issue_475 : : : : : : [ requires cxx17_hdr_optional ] ] + [ boost.test-self-test run : writing-test-ts : cxx17-optional-support : : : : : : [ requires cxx17_hdr_optional ] ] ; #_________________________________________________________________________________________________# diff --git a/test/writing-test-ts/github_issue_475.cpp b/test/writing-test-ts/cxx17-optional-support.cpp similarity index 51% rename from test/writing-test-ts/github_issue_475.cpp rename to test/writing-test-ts/cxx17-optional-support.cpp index 5959db92bd..ac21eba7a6 100644 --- a/test/writing-test-ts/github_issue_475.cpp +++ b/test/writing-test-ts/cxx17-optional-support.cpp @@ -2,14 +2,18 @@ // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt -#define BOOST_TEST_MODULE github_issue_475 +#define BOOST_TEST_MODULE cxx_std_optional_support #include #include -BOOST_TEST_DONT_PRINT_LOG_VALUE(std::optional) - BOOST_AUTO_TEST_CASE(test1) { - std::optional a,b; - BOOST_TEST(a==b); + std::optional a = 1, b = 2; + BOOST_TEST(a != b); +} + +BOOST_AUTO_TEST_CASE(test2) +{ + std::optional o; + BOOST_CHECK_EQUAL(o, std::nullopt); } From 5995bd6d14a2795a2c20146cc0009b06d48f0b4e Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Fri, 19 Jun 2026 10:11:30 +0200 Subject: [PATCH 2/2] GHA: Allow node 20 Deprecated but still supported until autumn --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24a0b1466b..61501d316c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,6 +27,7 @@ env: GIT_FETCH_JOBS: 8 NET_RETRY_COUNT: 5 DEFAULT_BUILD_VARIANT: release + ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true jobs: posix: