From 134475e292505bd5d7dcac649e4c87834e2df77a Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Fri, 28 Jun 2019 14:58:16 +0900 Subject: [PATCH] test: check ostream op for comment containers --- tests/test_comments.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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()); + } +}