Skip to content

Support static unit tests and guarded in-source doctest cases - #59

Merged
sean-parent merged 4 commits into
mainfrom
sean-parent/source-testing
Nov 19, 2026
Merged

sean-parent merged 4 commits into
mainfrom
sean-parent/source-testing

Conversation

@sean-parent

@sean-parent sean-parent commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Make private src/ headers available to implementations and unit tests, with src/private/ as the documented convention.
  • Provide private <cpp-library/testing.hpp> with the function-style CPP_LIBRARY_TESTING() macro, defined as 0 or 1.
  • Statically link the component under test while preserving existing per-file test executables and mains. Production and third-party dependency linkage remain client-controlled.
  • Run guarded doctest cases in implementation files through a separate executable, including unnamed-namespace and registration-only translation units.
  • Preserve finalized private build requirements and generated file-set header ordering across the separate compilations.
  • Document the additional compilation cost and add the regression to Linux and Windows CI.

Test plan

Fresh local validation at b584778352610c8b00ca5e35faabc1518d285c64, using macOS, CMake 4.5.0, Ninja 1.13.2, AppleClang/clangd 21, and Doxygen 1.18.0. Compiled script fixtures configure, build, and test internally.

  • cmake -P tests/install/CMakeLists.txt — dependency mapping/provider harness; zero failures. Its existing manual fatal-error case remains skipped.
  • cmake -P tests/install/test_provider_merge.cmake — provider merging.
  • cmake -P tests/install/test_nested_install.cmake — existing nested static/shared installation coverage.
  • cmake -P tests/install/test_package_ci.cmake — generated package artifact checks.
  • cmake -P tests/setup/test_target_type.cmake — target types and dialect settings.
  • cmake -P tests/setup/test_header_checks.cmake — independent public-header compilation, including C++17/20/23.
  • cmake -P tests/setup/test_source_testing.cmake — nine configurations covering static/shared production, C++17/20/23 source-only tests, expected assertion failure, disabled testing, header-only, and nested use. Checks exact-once embedded execution, compile-fail diagnostics, private requirements, and clean generated-header builds.
  • cmake -P tests/setup/test_version_override.cmake — scoped version overrides.
  • cmake -P tests/setup/test_install_dirs.cmake — installation directories.
  • cmake -P tests/setup/test_runtime_dlls.cmake — runtime deployment.
  • cmake -P tests/setup/test_setup_version_resolution.cmake — scaffold version resolution.
  • cmake -P tests/docs/test_docs.cmake — documentation configuration and rendering.
  • cmake -DCPP_LIBRARY_TEST_CLANGD=ON -DCPP_LIBRARY_TEST_COMPILER_ID=AppleClang -P tests/setup/test_clangd.cmake — required fresh clangd navigation and configure-only header commands.
  • git diff --check origin/main...HEAD, Ruby YAML parsing of .github/workflows/ci.yml, and the workflow's template-presence checks.
  • Hosted CI: all seven jobs passed at the PR head, including Windows static/DLL and PowerShell coverage, all three clangd platforms, generated-consumer integration, and documentation.

Generated with GitHub Copilot CLI

sean-parent and others added 4 commits November 19, 2026 12:22
Add private function-style testing configuration and preserve the existing per-file test executables and examples.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Compile implementation sources directly into an independent doctest runner, preserve private build requirements for static unit tests, and isolate DLL import definitions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Preserve per-file test mains, document the function-style configuration and private-header convention, register Linux/Windows checks, and retain source-backed Scout knowledge.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Share header generation between production and test targets, including default and named file sets without explicit consumer dependencies. Verify clean direct-target builds and keep the anonymous component present in both compilation modes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@sean-parent sean-parent left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Talos review

Verdict: no findings. Reviewed the full PR diff against main at b584778352610c8b00ca5e35faabc1518d285c64 (merge base 13ff79ac9fbbf575bbab0ab3dee0c752b4501fcc). This is a comment review, not approval.

Files Reviewers Candidates → validated → accepted Shown Tests
23 6 personas, challenge 0 → 0 → 0 0 of 0 All 13 repository script regressions passed locally, including required AppleClang clangd navigation, real-doctest source testing, C++17/20/23, and the existing install/docs suites. Workflow YAML parsing, template-presence checks, and git diff --check passed.

All six baseline personas completed: security, correctness, standards, architecture, operations, and documentation. The challenge reviewer validated the empty candidate set. Accepted findings: 0; posted inline comments: 0; overflow: 0; unanchored findings: 0; recurrences: 0. No prior PR review comments existed when checked.

Project context: CLAUDE.md and .github/copilot-instructions.md loaded from the merge-base revision. GitHub custom instructions: 1 instruction file, 23 matched paths, no diagnostics. No active spec context. Full diff supplied through immutable local artifacts; personas read those files rather than receiving duplicated inline diff text. Host-configured subagent models were used.

Persona routing: static roster (DCAP routing off; rerun with --dcap to enable).

Org knowledge: off (rerun with --knowledge).

Scout

Used: risk MEDIUM, evidence HIGH, status COMPLETE (scout 0.9.135, 1s).
Cross-file leads given to reviewers: 0 changed symbol(s) with uses outside the diff, 0 new value(s) not handled everywhere, 1 possibly unused symbol(s).

Tests to run (Scout: 14 Must Run test(s), in these files):

  • tests/setup/fixtures/source_testing/include/fixture/api.hpp
  • tests/setup/fixtures/source_testing/src/component.cpp
  • tests/setup/fixtures/source_testing/src/private/component.hpp
  • tests/setup/fixtures/source_testing/src/registration.cpp
  • tests/setup/fixtures/source_testing/tests/existing.cpp
  • tests/setup/fixtures/source_testing/examples/example.cpp
  • tests/setup/fixtures/source_testing/tests/rejected_fail.cpp
  • tests/setup/fixtures/mock_doctest.cmake

These are fixture locations, exercised through test_source_testing.cmake, test_header_checks.cmake, and test_target_type.cmake, not standalone test commands. Scout reported conservative whole-file roots for 14 changed files where snapshot/parser mapping did not yield precise hunk roots; persona review used the complete Git diff.

Verification limitations

Local validation ran on macOS with CMake 4.5.0, Ninja 1.13.2, AppleClang/clangd 21, and Doxygen 1.18.0. The dependency harness retains its existing intentional manual fatal-error-case skip. No unexpected top-level diagnostics appeared. Windows-specific behavior cannot be validated on this host. At the latest CI check, Ubuntu unit tests, all three clangd variants, integration tests, and documentation passed; Windows static/DLL consumer checks were still running. See the CI run.

@sean-parent
sean-parent merged commit b483efe into main Nov 19, 2026
7 checks passed
@sean-parent
sean-parent deleted the sean-parent/source-testing branch November 19, 2026 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant