Description
The ninja_with_exit_code fixture in tests/runner_tests.rs currently manipulates the global PATH environment variable to make a fake ninja executable available. This should be refactored to use the NINJA_ENV environment variable instead, mirroring the approach used in other test fixtures.
Context
This refactoring was suggested during the review of PR #89: #89 (comment)
Current Implementation
The fixture currently:
- Saves and modifies the PATH environment variable
- Prepends the fake ninja directory to PATH
- Returns a cleanup closure that restores the original PATH
Proposed Change
The fixture should instead:
- Use
NINJA_ENV to point directly to the fake ninja executable
- Save and restore the original
NINJA_ENV value
- Avoid PATH manipulation entirely
Benefits
- Cleaner test isolation (no global PATH modification)
- Consistency with other test fixtures in the codebase
- More predictable test behaviour
Implementation Notes
- The fixture is located at lines 34-56 in
tests/runner_tests.rs
- Should follow the same pattern as the
run_respects_env_override_for_ninja test
- Maintain the same return tuple structure
(tempfile::TempDir, PathBuf, Cleanup)
Requested by: @leynos
Description
The
ninja_with_exit_codefixture intests/runner_tests.rscurrently manipulates the global PATH environment variable to make a fake ninja executable available. This should be refactored to use theNINJA_ENVenvironment variable instead, mirroring the approach used in other test fixtures.Context
This refactoring was suggested during the review of PR #89: #89 (comment)
Current Implementation
The fixture currently:
Proposed Change
The fixture should instead:
NINJA_ENVto point directly to the fake ninja executableNINJA_ENVvalueBenefits
Implementation Notes
tests/runner_tests.rsrun_respects_env_override_for_ninjatest(tempfile::TempDir, PathBuf, Cleanup)Requested by: @leynos