Repository navigation
[IMPROVEMENT] Fail the tests when a command line option has no test - #2410
Open
Deepak-negi11 wants to merge 2 commits into
Open
Deepak-negi11 wants to merge 2 commits into
Deepak-negi11 wants to merge 2 commits into
Conversation
5 of 7 tasks
Deepak-negi11
force-pushed
the
test/cli-option-coverage
branch
from
October 24, 2026 23:04
c2111df to
2202b9b
Compare
5 of 7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In raising this pull request, I confirm the following (please check boxes):
Reason for this PR:
Sanity check:
Repro instructions:
cd src/rust && cargo test --lib test_every_option_has_a_testargs.rswith no test--srt(still in the list)mccfrom the list without adding a testPart of #2408 (step 2). Depends on #2409; this branch includes its commit.
Problem
Nothing stops an option from being added or changed without a test. 24 options have no test at all today, including
--stdin,--udp,--tcp,--stream,--srt,--samiand--smi. (-smiis in fact broken right now.)What this adds
test_every_option_has_a_test: gets every option from clap and checks that a test passes it on the command line, as--nameor-name. Only the test modules ofparser.rsandlib.rs, pluscli_tests.rs, are searched, so option names in normal code don't count.UNTESTED_OPTIONS: the 24 options without a test today. The test also fails if a listed option gets a test, so the list can only shrink. The next PRs add the missing tests and empty it.Testing
cargo test(439 passed),cargo fmt --check,cargo clippy -- -D warnings.