A test with an empty body is no test

Open
#583 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
cpp, java, python, rust
Domain
testing-qa

Research direction

Start by reading the implementation changed for #503 and the tests for tests-run in the project; the issue names no file paths, so first locate how framework test declarations are detected. Add cases for empty Rust, JUnit, gtest, and pytest test bodies, then verify each is rejected while a test containing one statement still passes. Keep empty dune stanzas and busted specs out of scope.

Written by the indexing model from the issue text.

Description

Problem

#503 made CTest no-op commands (true, echo, cmake -E true) count for nothing. An empty test function still passes tests-run:

  • Rust #[test] fn t() {}
  • JUnit @Test void t() {}
  • gtest TEST(A, B) {}
  • pytest def test_t(): pass

Expected

A policy table, per framework, of how a test function is declared. A unit whose only tests have empty bodies has no tests. Empty dune stanzas, busted specs and the like stay with coverage reach and #459, as #480 said.

Done when

Each case above fails tests-run, and a test with one statement still passes.

Split from #480. Checked against main at 4b4dbb6c on 2026-12-03: the cases above were reproduced with small fixtures or found in the code.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ByTXNqDWdM7HzezrFtEvQt

Dominant language
Python
Stars
4
Forks
1
Avg merge
6h 31m
Merged PRs (30d)
238

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from cpp-best-practices/project_validator

All issues in cpp-best-practices/project_validator

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.