MCPcopy Create free account
hub / github.com/boostorg/json / testStickyErrors

Function testStickyErrors

test/basic_parser.cpp:1635–1668  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1633 }
1634
1635 void
1636 testStickyErrors()
1637 {
1638 {
1639 null_parser p;
1640 system::error_code ec;
1641 p.write("*", 1, ec);
1642 BOOST_TEST(ec);
1643 system::error_code ec2;
1644 p.write("[]", 2, ec2);
1645 BOOST_TEST(ec2 == ec);
1646 p.reset();
1647 p.write("[]", 2, ec2);
1648 BOOST_TEST(! ec2);
1649 }
1650
1651 // exceptions do not cause UB
1652 {
1653 throw_parser p(1);
1654 try
1655 {
1656 system::error_code ec;
1657 p.write(false, "null", 4, ec);
1658 BOOST_TEST_FAIL();
1659 }
1660 catch(std::exception const&)
1661 {
1662 system::error_code ec;
1663 p.write(false, "null", 4, ec);
1664 BOOST_TEST(ec == error::exception);
1665 BOOST_TEST(ec.has_location());
1666 }
1667 }
1668 }
1669
1670#ifndef BOOST_NO_CXX17_HDR_STRING_VIEW
1671 using SV = std::string_view;

Callers 1

runFunction · 0.85

Calls 2

writeMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected