diff --git a/tests/test_parse_file.cpp b/tests/test_parse_file.cpp index 6283c04..e2d499b 100644 --- a/tests/test_parse_file.cpp +++ b/tests/test_parse_file.cpp @@ -193,6 +193,34 @@ BOOST_AUTO_TEST_CASE(test_hard_example) BOOST_CHECK(toml::find>(bit, "multi_line_array") == expected_multi_line_array); } +BOOST_AUTO_TEST_CASE(test_hard_example_comment) +{ + const auto data = toml::parse("toml/tests/hard_example.toml"); + const auto the = toml::find(data, "the"); + BOOST_CHECK_EQUAL(toml::find(the, "test_string"), + "You'll hate me after this - #"); + + const auto hard = toml::find(the, "hard"); + const std::vector expected_the_hard_test_array{"] ", " # "}; + BOOST_CHECK(toml::find>(hard, "test_array") == + expected_the_hard_test_array); + const std::vector expected_the_hard_test_array2{ + "Test #11 ]proved that", "Experiment #9 was a success"}; + BOOST_CHECK(toml::find>(hard, "test_array2") == + expected_the_hard_test_array2); + BOOST_CHECK_EQUAL(toml::find(hard, "another_test_string"), + " Same thing, but with a string #"); + BOOST_CHECK_EQUAL(toml::find(hard, "harder_test_string"), + " And when \"'s are in the string, along with # \""); + + const auto bit = toml::find(hard, "bit#"); + BOOST_CHECK_EQUAL(toml::find(bit, "what?"), + "You don't think some user won't do that?"); + const std::vector expected_multi_line_array{"]"}; + BOOST_CHECK(toml::find>(bit, "multi_line_array") == + expected_multi_line_array); +} + BOOST_AUTO_TEST_CASE(test_example_preserve_comment) {