[go: up one dir, main page]

File: test_comments.cpp

package info (click to toggle)
toml11 4.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,464 kB
  • sloc: cpp: 38,446; makefile: 8; sh: 5
file content (21 lines) | stat: -rw-r--r-- 513 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN
#include <doctest/doctest.h>

#include <toml.hpp>

TEST_CASE("testing comments on simple value")
{
    const toml::value root = toml::parse_str(R"(
        # comment 1
        # comment 2
        a = "foo" # comment 3

        # comment 4
    )");

    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");
}