test: check ostream op for comment containers

This commit is contained in:
ToruNiina 2019-06-28 14:58:16 +09:00
parent 28b3f7d6fb
commit 134475e292

View File

@ -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<toml::preserve_comments>;
{
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());
}
}