-
-
Notifications
You must be signed in to change notification settings - Fork 2
refactor: extract CLI tests from main.rs into integration tests #61
Copy link
Copy link
Labels
cliCommand-line interface and toolsCommand-line interface and toolsenhancementNew feature or requestNew feature or requestpriority:lowNice to have, can deferNice to have, can defersize:MThis PR changes 30-99 lines, ignoring generated files.This PR changes 30-99 lines, ignoring generated files.testingTest infrastructure and coverageTest infrastructure and coverage
Milestone
Metadata
Metadata
Assignees
Labels
cliCommand-line interface and toolsCommand-line interface and toolsenhancementNew feature or requestNew feature or requestpriority:lowNice to have, can deferNice to have, can defersize:MThis PR changes 30-99 lines, ignoring generated files.This PR changes 30-99 lines, ignoring generated files.testingTest infrastructure and coverageTest infrastructure and coverage
Type
Fields
Give feedbackNo fields configured for Task.
Summary
src/main.rsis 1,647 lines, of which ~1,100 are colocated#[cfg(test)]tests. The CLI tests use low-level Unix fd manipulation (dup,dup2vianixcrate) for stdin mocking, which is fragile -- evidenced by theLLVM_PROFILE_FILEworkaround that skips these tests under llvm-cov instrumentation.Current Problems
dup2_stdin,dup2_stdout,dup2_stderroperations are process-wide and not thread-safe (requiresFD_MUTEXand--test-threads=1)process_file,validate_arguments) rather than testing the binary interfaceProposal
tests/cli_integration.rsusingassert_cmdcratermagicbinary as a subprocess (natural process isolation)output_format(),validate_arguments()) in main.rsassert_cmd'swrite_stdin()for stdin testing (no fd manipulation needed)Example
Acceptance Criteria
main.rsunder 600 linestests/cli_integration.rsnixdev-dependency removed (or only used where truly needed)FD_MUTEXand fd manipulation removed