Skip to content

Commit 83db51b

Browse files
committed
[TEST] Prettier header test files
Makes it easier to debug because generated code is now annotated.
1 parent 3116d4b commit 83db51b

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

test/header/generate_header_source.cmake

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,47 +17,49 @@ if (HEADER_SUB_TEST STREQUAL "no-self-include")
1717

1818
string (REPLACE "#pragma once" "" header_content "${header_content}")
1919

20-
file (APPEND "${HEADER_TARGET_SOURCE}" "${header_content}\n")
20+
file (APPEND "${HEADER_TARGET_SOURCE}"
21+
"// seqan3-header-test-no-self-include-start\n"
22+
"${header_content}\n"
23+
"// seqan3-header-test-no-self-include-end\n\n")
2124
else ()
2225
# this test ensures that a header guard is in place
2326
file (APPEND "${HEADER_TARGET_SOURCE}" #
27+
"// seqan3-header-test-header-guard-start\n"
2428
"#include <${HEADER_FILE_INCLUDE}>\n" #
25-
"#include <${HEADER_FILE_INCLUDE}>\n")
29+
"#include <${HEADER_FILE_INCLUDE}>\n"
30+
"// seqan3-header-test-header-guard-end\n\n")
2631
endif ()
2732

2833
# these includes are required by some headers (note that they follow)
2934
file (APPEND "${HEADER_TARGET_SOURCE}" #
35+
"// seqan3-header-test-dependencies-start\n"
3036
"#include <gtest/gtest.h>\n" #
3137
"#include <benchmark/benchmark.h>\n" #
32-
"TEST(${HEADER_TEST_NAME_SAFE}) {}\n")
38+
"TEST(${HEADER_TEST_NAME_SAFE}) {}\n"
39+
"// seqan3-header-test-dependencies-end\n\n")
3340

3441
# test that seqan3 headers include platform.hpp
3542
if ("${HEADER_COMPONENT}" MATCHES "seqan3")
3643

3744
# exclude seqan3/std/* and seqan3/contrib/* from platform test
3845
if (NOT HEADER_FILE_INCLUDE MATCHES "seqan3/(std|contrib)/")
3946
file (APPEND "${HEADER_TARGET_SOURCE}" #
47+
"// seqan3-header-test-platform-start\n"
4048
"#ifndef SEQAN3_DOXYGEN_ONLY\n" #
4149
"#error \"Your header '${HEADER_FILE_INCLUDE}' file is missing #include <seqan3/core/platform.hpp>\"\n" #
42-
"#endif\n")
50+
"#endif\n"
51+
"// seqan3-header-test-platform-end\n\n")
4352
endif ()
4453

4554
# seqan3/std/* must not include platform.hpp (and therefore any other seqan3 header)
4655
# See https://github.com/seqan/product_backlog/issues/135
4756
if (HEADER_FILE_INCLUDE MATCHES "seqan3/std/")
4857
file (APPEND "${HEADER_TARGET_SOURCE}" #
58+
"// seqan3-header-test-no-platform-start\n"
4959
"#ifdef SEQAN3_DOXYGEN_ONLY" #
5060
"#error \"The standard header '${HEADER_FILE_INCLUDE}' file MUST NOT include any other " #
5161
"seqan3 header (except for seqan3/contrib)\"\n" #
52-
"#endif\n")
62+
"#endif\n"
63+
"// seqan3-header-test-no-platform-end\n\n")
5364
endif ()
54-
55-
# test whether seqan3 has the visibility bug on lower gcc versions
56-
# https://github.com/seqan/seqan3/issues/1317
57-
file (APPEND "${HEADER_TARGET_SOURCE}" #
58-
"#include <seqan3/core/platform.hpp>\n\n" #
59-
"class A{ int i{5}; };\n\n" #
60-
"template <typename t>\n" #
61-
"concept private_bug = requires(t a){a.i;};\n\n" #
62-
"static_assert(!private_bug<A>, \"See https://github.com/seqan/seqan3/issues/1317\");\n")
6365
endif ()

0 commit comments

Comments
 (0)