Skip to content

style: bring native_tests under the clang-format gate - #13

Merged
jwinarske merged 1 commit into
jw/pin-format-toolchainfrom
jw/format-native-tests
Aug 14, 2026
Merged

style: bring native_tests under the clang-format gate#13
jwinarske merged 1 commit into
jw/pin-format-toolchainfrom
jw/format-native-tests

Conversation

@jwinarske

Copy link
Copy Markdown
Contributor

Stacked on #12 — review that first; this PR targets its branch so the diff shows only the reformat. Rebases onto main once #12 merges.

The gap

CI's clang-format job globbed find src include tests, but tests/ was renamed native_tests/ in 0.2.2. find printed 'tests': No such file or directory and carried on, and because a pipeline's exit status comes from its last command — clang-format, not find — the job stayed green while silently checking nothing in the native test suite.

So native_tests/ had never been formatted. It carried 1233 violations, under clang-format 18 and 22 alike.

The change

native_tests joins CXX_DIRS in scripts/format.sh (#12 made that the single source of truth for both CI jobs), and clang-format 18.1.8 — the pinned version — is applied.

This is mechanical

The diff is ~1000 lines, so the no-behavior-change claim is verified rather than asserted. Per file:

  • Body token streams are byte-identical with all whitespace removed
  • #include sets are identical as multisets, so nothing was added or dropped

That leaves exactly two kinds of difference: line wrapping, and include ordering from clang-format's SortIncludes. The C++ suite rebuilds and passes 149/149 — the same count as before, so no test was accidentally renamed out of discovery.

Follow-up

scripts/test.sh and .github/workflows/ci.yml still each spell out their own CMake flags. That duplication is what let the BUILD_TESTING / APPSTREAM_BUILD_TESTS mismatch survive in 0.4.0 and this tests/ path survive since 0.2.2. Worth collapsing the same way formatting just was, but not in this PR.

The CI clang-format job globbed `find src include tests`, but tests/ was
renamed native_tests/ in 0.2.2. find printed an error and moved on, and
because the pipeline's exit status comes from clang-format rather than
find, the job stayed green while silently checking nothing in the native
test suite. It had therefore never been formatted, and carried 1233
violations under both clang-format 18 and 22.

Add native_tests to CXX_DIRS in scripts/format.sh — which #12 made the
single source of truth for both CI jobs — and apply clang-format 18.1.8,
the pinned version.

This is a mechanical reformat with no behavior change. Verified per file:
every body's token stream is byte-identical with whitespace removed, and
every #include set is unchanged as a multiset, so the only differences are
line wrapping and include ordering (clang-format's SortIncludes). The C++
suite still builds and passes 149/149, the same count as before.
@jwinarske
jwinarske force-pushed the jw/format-native-tests branch from a052b60 to b5d0bc2 Compare August 14, 2026 16:25
@jwinarske
jwinarske merged commit 55233c7 into jw/pin-format-toolchain Aug 14, 2026
@jwinarske
jwinarske deleted the jw/format-native-tests branch August 14, 2026 17:28
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