Skip to content

Commit

Permalink
Verify that include guards work correctly
Browse files Browse the repository at this point in the history
Note that this test case does not fail because the test parser does not
use the same config flags as the real parser (it is not setting the
fast_preprocessing flag.)

Also, this test is extremely flaky. Renaming the XXX guard in some ways,
make it pass, as does removing the #include.
  • Loading branch information
saraedum committed Jan 24, 2020
1 parent b681fa6 commit f3838f5
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/documentation.cpp
Expand Up @@ -154,6 +154,33 @@ namespace ns
</file-documentation>
)*");
}

SECTION("include guards")
{
auto file = build_doc_entities(comments, index, "documentation__guards.hpp", R"(
#ifndef XXX
#define XXX
#include <type_traits>
class X {};
#endif
)");

auto doc = generate_documentation({}, {}, index, *file);
REQUIRE(markup::as_xml(*doc) == R"*(<file-documentation id="documentation__guards.hpp">
<heading>Header file <code>documentation__guards.hpp</code></heading>
<code-block language="cpp"><code-block-preprocessor>#define</code-block-preprocessor> <code-block-identifier>XXX</code-block-identifier><soft-break></soft-break>
<soft-break></soft-break>
<code-block-keyword>class</code-block-keyword> <code-block-identifier>X</code-block-identifier><code-block-punctuation>;</code-block-punctuation><soft-break></soft-break>
</code-block>
</file-documentation>
)*");

}


SECTION("inlines")
{
auto file = build_doc_entities(comments, index, "documentation__inlines.cpp", R"(
Expand Down

0 comments on commit f3838f5

Please sign in to comment.