Skip to content

feat(testing): add a C++ adapter to the cannot-fail scanner (GoogleTest, Catch2) #6236

Closed as not planned

Description

@kyle-sexton

Summary

The testing plugin's cannot-fail scanner (/testing:audit, and the test-scan and test-weaken hooks that run the same engine) covers JS/TS, Python, C#, Bash, PowerShell and Go. C++ test files are never enumerated, so a GoogleTest or Catch2 test with no assertion, or one that can only pass, goes unreported and the hooks never fire on a C++ test edit. Add a C++ adapter for GoogleTest and Catch2.

Assertion forms to recognize:

The fatal and nonfatal forms (ASSERT_/EXPECT_, REQUIRE/CHECK) are the same assertion with different abort behaviour; both count. Each is one ;-terminated statement, the shape the C# and JS adapters already split on.

Scope

  • plugins/testing/skills/audit/adapters/cpp-googletest.yaml and cpp-catch2.yaml: files: globs (for example *_test.cc, *_test.cpp, *Test.cpp, *Tests.cpp, test_*.cpp; confirm against each framework's conventions), test_start for TEST(, TEST_F(, TEST_P(, TYPED_TEST( and Catch2's TEST_CASE(, SCENARIO(, SECTION(, test_skip (DISABLED_ name prefix, GTEST_SKIP(), Catch2 [.] and [!mayfail] tags, SKIP(), and the assertion, weak, inert (EXPECT_TRUE(true), REQUIRE(true)), count, fail (FAIL(), ADD_FAILURE()) and mock (gMock EXPECT_CALL) token sets.
  • Masker: reuse mask_cs in plugins/testing/skills/audit/scripts/cant-fail-scan.awk (// and /* */ comments, " and ' literals) with C++ raw strings R"delim(...)delim", which may span lines, and without C#'s @" and $" prefixes; add mask_cpp if that cannot share mask_cs cleanly, register it in mask_open, and route language: cpp to it.
  • Corpus fixtures under plugins/testing/skills/audit/evals/fixtures/corpus/<adapter-id>/{bad,good}/ (stored as .fixture), each listed in corpus_files in cant-fail-scan.test.sh.
  • Regenerate plugins/testing/hooks/hooks.json with plugins/testing/scripts/gen-hook-filters.sh so the hooks' if rows include the new globs.
  • Add C++ to the language lists in plugins/testing/skills/audit/SKILL.md (description and ecosystems paragraph) and plugins/testing/README.md.
  • Version bump and CHANGELOG entry for testing.

Acceptance criteria

  • A GoogleTest TEST(...) and a Catch2 TEST_CASE(...) with no assertion each report rule-zero-assertion.
  • A test with one real EXPECT_EQ/ASSERT_EQ or REQUIRE/CHECK reports nothing.
  • Two assertions on one line (EXPECT_EQ(a, 1); EXPECT_TRUE(true);) are classified per statement: the inert second statement is reported.
  • An assertion macro name inside an R"(...)" raw string, including one spanning lines, or inside a comment does not count as an assertion.
  • A disabled test (DISABLED_ prefix, Catch2 [.] tag) is not reported as zero-assertion.
  • Every new fixture is in corpus_files, and cant-fail-scan.test.sh and check-corpus-grid.sh pass.
  • gen-hook-filters.sh --check passes after regeneration, and gen-hook-filters.test.sh passes.

Dependencies

Land after the in-flight scanner PR for #6211, #6218 and #6040, since all of them edit cant-fail-scan.awk, the corpus list and hooks.json. Run the four language adapters (Kotlin, C++, PHP, Ruby) one at a time for the same reason.

Rough size

Small to medium if mask_cs can be reused with a raw-string addition. Assertions are macros with fixed names and ; terminators, so the token sets are the simplest of the four languages; Catch2's nested SECTION blocks are the part to check against the block model.

Activity

  1. github-actions commented on Oct 4, 2026

    @github-actions
    Contributor

    Triage: this requests a new C++ adapter (GoogleTest and Catch2) for the cannot-fail scanner, covering the test_start/test_skip/assertion/weak/inert/count/fail/mock token sets, a masker update for raw strings, new corpus fixtures, regenerated hook filters, and doc/version updates. The scope, acceptance criteria, and sequencing (land after #6211, #6218, #6040, and run one adapter at a time alongside the sibling Kotlin/#6235, PHP/#6237, and Ruby/#6238 adapter issues) are already spelled out, so nothing appears missing here. No duplicate open issues were found.

    Automated triage. A maintainer reviews it.

  2. kyle-sexton commented on Oct 13, 2026

    @kyle-sexton
    MemberAuthor

    Owner decision (2026-10-13): approved the recommendation.

    Next: nobody acts now. Pick it up when one of the triggers above appears.

    This was generated by AI.

  3. added
    needs-human
    on Oct 19, 2026
  4. kyle-sexton commented on Oct 19, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during triage.

    Held: the owner decided on 2026-10-13 to hold the C++ adapter (with #6235, #6237, #6238) until a repository the owner works in uses C++ or an outside user asks.

  5. kyle-sexton commented on Oct 24, 2026

    @kyle-sexton
    MemberAuthor

    Decision recorded. Owner, Backlog HITL session, 2026-10-24. Q99: "Should the six issues parked until demand appears close as not planned, each with a reopen note?" Answer: "yes, go w/ recomended". To reopen: reopen this issue when a repo uses this or a user asks for it; the body and decisions above stay as the spec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-human

    Fields

    No fields configured for Feature.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions