diff --git a/tests/test_comments.cpp b/tests/test_comments.cpp index 1852dee..5a3389c 100644 --- a/tests/test_comments.cpp +++ b/tests/test_comments.cpp @@ -460,3 +460,19 @@ BOOST_AUTO_TEST_CASE(test_overwrite_comments) BOOST_TEST(u.as_integer() == 42); } } + +BOOST_AUTO_TEST_CASE(test_output_comments) +{ + using value_type = toml::basic_value; + { + const value_type v(42, {"comment1", "comment2"}); + std::ostringstream oss; + oss << v.comments(); + + std::ostringstream ref; + ref << "#comment1\n"; + ref << "#comment2\n"; + + BOOST_TEST(oss.str() == ref.str()); + } +}