Skip to content

Commit

Permalink
Improved dynamic_capture/append testing
Browse files Browse the repository at this point in the history
  • Loading branch information
zajo committed Dec 21, 2023
1 parent 4cf7fad commit 14ef85b
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions test/dynamic_capture_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

#include <boost/leaf/config.hpp>

#if BOOST_LEAF_CFG_STD_STRING
# include <sstream>
# include <iostream>
#endif

#if !BOOST_LEAF_CFG_CAPTURE

#include <iostream>
Expand Down Expand Up @@ -213,6 +218,23 @@ int main()
BOOST_TEST_EQ(err<3>::count, 1);
BOOST_TEST_EQ(err<1>::move_count, 0);
BOOST_TEST_EQ(err<2>::move_count, 0);
BOOST_TEST(!r);
#if BOOST_LEAF_CFG_STD_STRING
{
std::ostringstream st;
st << r;
std::string s = st.str();
std::cout << s << std::endl;
if( BOOST_LEAF_CFG_DIAGNOSTICS )
{
auto n1 = s.find("err<1>");
auto n3 = s.find("err<3>");
BOOST_TEST_NE(n1, s.npos);
BOOST_TEST_NE(n3, s.npos);
BOOST_TEST_LT(n1, n3);
}
}
#endif
int r1 = leaf::try_handle_all(
[&]() -> leaf::result<int>
{
Expand Down Expand Up @@ -273,6 +295,23 @@ int main()
BOOST_TEST_EQ(err<3>::count, 1);
BOOST_TEST_EQ(err<1>::move_count, 0);
BOOST_TEST_EQ(err<2>::move_count, 0);
BOOST_TEST(!r);
#if BOOST_LEAF_CFG_STD_STRING
{
std::ostringstream st;
st << r;
std::string s = st.str();
std::cout << s << std::endl;
if( BOOST_LEAF_CFG_DIAGNOSTICS )
{
auto n1 = s.find("err<1>");
auto n3 = s.find("err<3>");
BOOST_TEST_NE(n1, s.npos);
BOOST_TEST_NE(n3, s.npos);
BOOST_TEST_LT(n3, n1);
}
}
#endif
int r1 = leaf::try_handle_all(
[&]() -> leaf::result<int>
{
Expand Down

0 comments on commit 14ef85b

Please sign in to comment.