| 516 | } |
| 517 | |
| 518 | void run() |
| 519 | { |
| 520 | testNull(); |
| 521 | testBoolean(); |
| 522 | testIntegral(); |
| 523 | testFloatingPoint(); |
| 524 | testString(); |
| 525 | testSequence(); |
| 526 | testMap(); |
| 527 | testTuple(); |
| 528 | testStruct(); |
| 529 | testEnum(); |
| 530 | testOptional(); |
| 531 | testPath(); |
| 532 | testVariant<variant2::variant, variant2::monostate>(); |
| 533 | #ifndef BOOST_NO_CXX17_HDR_VARIANT |
| 534 | testVariant<std::variant, std::monostate>(); |
| 535 | #endif |
| 536 | |
| 537 | { |
| 538 | int n; |
| 539 | BOOST_TEST_THROWS_WITH_LOCATION( parse_into( n, "null" ) ); |
| 540 | |
| 541 | std::stringstream is("null"); |
| 542 | BOOST_TEST_THROWS_WITH_LOCATION( parse_into( n, is ) ); |
| 543 | } |
| 544 | |
| 545 | { |
| 546 | int n; |
| 547 | system::error_code ec; |
| 548 | parse_into( n, "12 1", ec); |
| 549 | BOOST_TEST( ec == error::extra_data ); |
| 550 | BOOST_TEST( ec.has_location() ); |
| 551 | } |
| 552 | |
| 553 | { |
| 554 | std::stringstream is("12 1"); |
| 555 | int n; |
| 556 | system::error_code ec; |
| 557 | parse_into( n, is, ec); |
| 558 | BOOST_TEST( ec == error::extra_data ); |
| 559 | BOOST_TEST( ec.has_location() ); |
| 560 | } |
| 561 | |
| 562 | { |
| 563 | int n; |
| 564 | std::stringstream is("1"); |
| 565 | is.setstate( std::ios::failbit ); |
| 566 | system::error_code ec; |
| 567 | parse_into(n, is, ec); |
| 568 | BOOST_TEST( ec == error::input_error ); |
| 569 | BOOST_TEST( ec.has_location() ); |
| 570 | } |
| 571 | } |
| 572 | }; |
| 573 | |
| 574 | TEST_SUITE(parse_into_test, "boost.json.parse_into"); |
nothing calls this directly
no test coverage detected