2024-06-15 19:14:06 +09:00
|
|
|
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
|
|
|
|
#include "doctest.h"
|
2020-10-13 22:04:28 +09:00
|
|
|
|
2024-06-15 19:14:06 +09:00
|
|
|
#include <toml.hpp>
|
2019-06-28 14:58:16 +09:00
|
|
|
|
2024-06-15 19:14:06 +09:00
|
|
|
TEST_CASE("testing comments on simple value")
|
2019-06-28 14:58:16 +09:00
|
|
|
{
|
2024-06-15 19:14:06 +09:00
|
|
|
const toml::value root = toml::parse_str(R"(
|
|
|
|
# comment 1
|
|
|
|
# comment 2
|
|
|
|
a = "foo" # comment 3
|
2019-06-28 19:09:05 +09:00
|
|
|
|
2024-06-15 19:14:06 +09:00
|
|
|
# comment 4
|
|
|
|
)");
|
2019-06-28 19:09:05 +09:00
|
|
|
|
2024-06-15 19:14:06 +09:00
|
|
|
const auto& a = root.at("a");
|
|
|
|
CHECK_EQ(a.comments().size(), 3);
|
|
|
|
CHECK_EQ(a.comments().at(0), "# comment 1");
|
|
|
|
CHECK_EQ(a.comments().at(1), "# comment 2");
|
|
|
|
CHECK_EQ(a.comments().at(2), "# comment 3");
|
2019-06-28 14:58:16 +09:00
|
|
|
}
|