From 6182f3ee9d429128a0717f2f7e6941241e600d74 Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Fri, 28 Jun 2019 17:56:41 +0900 Subject: [PATCH] test: add test for operator<<(os, non-table-value) --- tests/test_comments.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_comments.cpp b/tests/test_comments.cpp index 5a3389c..3164bf8 100644 --- a/tests/test_comments.cpp +++ b/tests/test_comments.cpp @@ -475,4 +475,15 @@ BOOST_AUTO_TEST_CASE(test_output_comments) BOOST_TEST(oss.str() == ref.str()); } + { + const value_type v(42, {"comment1", "comment2"}); + std::ostringstream oss; + + // If v is not a table, toml11 assumes that user is writing something + // like the following. + + oss << "answer = " << v; + + BOOST_TEST(oss.str() == "answer = 42 #comment1comment2"); + } }