Skip to content

[IMPROVEMENT] Test command line options through ccxr_parse_parameters into C - #2409

Open
Deepak-negi11 wants to merge 1 commit into
CCExtractor:masterfrom
Deepak-negi11:test/cli-through-c
Open

Deepak-negi11 wants to merge 1 commit into
CCExtractor:masterfrom
Deepak-negi11:test/cli-through-c

Conversation

@Deepak-negi11

@Deepak-negi11 Deepak-negi11 commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

In raising this pull request, I confirm the following (please check boxes):

Reason for this PR:

  • This PR adds new functionality.
  • This PR fixes a bug that I have personally experienced or that a real user has reported and for which a sample exists.
  • This PR is porting code from C to Rust.

Sanity check:

  • I have read and understood the contributors guide.
  • I have checked that another pull request for this purpose does not exist.
  • If the PR adds new functionality, I've added it to the changelog. If it's just a bug fix, I have NOT added it to the changelog.
  • I am NOT adding new C code unless it's to fix an existing, reproducible bug.

Repro instructions:

cd src/rust && cargo test --lib cli_tests

To see what the new tests catch, make one of these changes and run both test sets:

Change Other tests (437) New tests
Stop copying --ucla to C (common.rs) all pass test_ucla_reaches_c fails
Stop copying --no-fontcolor to C all pass test_no_font_color_reaches_c fails
Stop copying --gui-mode-reports to C all pass test_gui_mode_reports_reaches_c fails

Part of #2408 (first step).

Problem

The parser tests check the Rust settings right after parsing. They never run the real entry point that converts old spellings, and they never look at what C receives. So bugs in those two places pass every test, like the ones fixed in #2367, #2370 and #2397.

What this adds

src/rust/src/cli_tests.rs:

  • A helper that runs options through ccxr_parse_parameters, the same function main() calls, and returns copies of the ccx_options and tlt_config that C reads. (In cargo test no C code runs, so the tests check what copy_from_rust writes for C.) It holds a lock because those are global.
  • Every parse starts from zeroed options, so one test can't see values left by another.
  • 12 tests checking the C values for new and old spellings: --delay, --out, --ucla, --608, --no-fontcolor, --gui-mode-reports, --startat, --sentencecap, --mkvlang, --tpage, plus an unknown option being rejected.

Next steps (separate PRs): a test that fails when an option has no test, then tests for the options that have none yet.

Testing

  • cargo test (437 passed), cargo fmt --check, cargo clippy -- -D warnings.
  • New tests run 5 times in a row with no failures, so the lock prevents conflicts between parallel tests.

Copilot AI balanced review requested due to automatic review settings October 20, 2026 19:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@Deepak-negi11 Deepak-negi11 changed the title [IMPROVEMENT] Test command line options through ccxr_parse_parameters… [IMPROVEMENT] Test command line options through ccxr_parse_parameters into C Oct 24, 2026
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.

2 participants