tests/
tests/ holds the test suites of the MrDocs library and tool, each its own executable target and not one binary behind flags.
Each suite has its own CMakeLists.txt, and tests/CMakeLists.txt adds them to the build.
The unit and golden suites link the test_suite framework from libs/test_suite.
Content that belongs elsewhere
| Content | Where it goes |
|---|---|
Tests of a standalone component |
|
Tests of an example project |
The |
The test framework itself |
|
Scripts that run the suites or drive CI |
|
Contents by suite
| Directory | Purpose |
|---|---|
|
Unit tests, mirroring the module layout of A test for
A unit test mirrors the header it tests, as Unit tests mirror headers describes. |
|
The reference-output harness. It walks The harness is The fixtures under |
|
Suites that use the built tool or the installed package from outside, as a user does. Every test carries the |
|
The plugin API and the plugin loader. It builds a plugin that calls the API and loads it, checks the export table of the tool, and covers every plugin MrDocs must refuse.
* |
|
An out-of-tree project that consumes an installed MrDocs the way a user does, with |
|
The
*
* |
|
Benchmarks kept to re-measure numbers that the docs or a PR quote. They are custom targets, not CTest tests. |
Unit tests mirror headers
A unit test tests/unit/<path>.cpp needs a header <path>.hpp under include/mrdocs/ or src/mrdocs/.
The same holds in each library: libs/<lib>/tests/unit/<path>.cpp needs libs/<lib>/include/mrdocs/<path>.hpp.
tests/unit/Extensions/ScriptContext.cpp: no header Extensions/ScriptContext.hpp under include/mrdocs/ or src/mrdocs/; a unit test mirrors the header it tests
The fix is to move the tests into the file of the header whose API they exercise.
tests/unit/UnitMain.cpp is the test driver and has no header.
|
Guard
|
Build integration
The root build adds tests/ when MRDOCS_BUILD_TESTS is on.
tests/CMakeLists.txt adds unit, golden, benchmarks, integration and self-doc.
tests/integration/cmake/ is the exception: no add_subdirectory reaches it, because CI configures it as a separate project against an install prefix.
| Target or test | Defined in |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|