Repository navigation
[IMPROVEMENT] Test command line options through ccxr_parse_parameters into C - #2409
Deepak-negi11 wants to merge 1 commit into
Conversation
573ba91 to
3651944
Compare
… into the C options
3651944 to
a70d6a6
Compare
CCExtractor CI platform finished running the test files on linux. 172/238 tests matched the approved output:
66 tests do not match the approved output. That is the pass/fail verdict. Whether this branch caused it is a separate question, answered below.
Compared with the tip of master — test 9984, commit 24d1e0a:
Compared with the commit this branch was cut from: the same run as the tip of master (test 9984), so the comparison above already covers it. No test changes behaviour relative to the tip of master: every failure above fails there too, byte for byte. The approved output for those tests is out of date, which is a baseline to review rather than a regression in this branch. |
CCExtractor CI platform finished running the test files on windows. 172/238 tests matched the approved output:
66 tests do not match the approved output. That is the pass/fail verdict. Whether this branch caused it is a separate question, answered below.
Compared with the tip of master — test 9985, commit 24d1e0a:
Compared with the commit this branch was cut from: the same run as the tip of master (test 9985), so the comparison above already covers it. No test changes behaviour relative to the tip of master: every failure above fails there too, byte for byte. The approved output for those tests is out of date, which is a baseline to review rather than a regression in this branch. |
Repro instructions:
This PR only adds tests, so there's no bug to reproduce. Here's how to check that they catch something the old tests miss.
Run the tests. All 439 pass:
Now break something on purpose. In
src/rust/src/common.rs, delete this line, so--uclanever reaches C:Run the tests again. The other 438 still pass, and
test_cases_reach_cfails with["input.ts", "--ucla"] did not reach C as expected.Part of #2408 (step 1 of 4).
What's wrong
The parser tests only check the Rust options right after parsing. They never run the real entry point, which also converts old spellings like
-UCLA, and they never check what C gets. So bugs in those two places pass every test. #2367, #2370 and #2397 were bugs like that.What this adds
src/rust/src/cli_tests.rs:parse_to_cruns the arguments throughccxr_parse_parameters, the same functionmain()calls, and returns copies ofccx_optionsandtlt_configas C sees them. No C code runs incargo test, so this checks whatcopy_from_rustwrites for C. It holds a lock because those are globals, and it zeroes them before each parse so one test can't see what another left behind.cases(): one table. Each entry has one or more ways to write some options (new and old spellings) and a check on the C options they give.test_cases_reach_cruns every spelling of every entry and fails if one is rejected or its check fails.--delay,--out/--webvtt,--ucla,--608,--no-fontcolor,--gui-mode-reports,--startat,--sentencecap,--mkvlangand--tpage, most with their old spelling too.The tests are a table so that #2410 can count which options really have a check on the C side.
Testing
cargo test(439 passed),cargo fmt --check,cargo clippy -- -D warnings.