Add Ninja snapshot test for command_available expansion (#310)#360
Add Ninja snapshot test for command_available expansion (#310)#360leynos wants to merge 1 commit into
Conversation
PR #309 introduced the `command_available` stdlib predicate but no snapshot pinned the generated Ninja output for the path where a `when: command_available(...)` / `when: not command_available(...)` pair filters top-level actions before `ninja_gen::generate`. Add `command_available_manifest_ninja_snapshot`, modelled on `conditional_manifest_ninja_snapshot`: the manifest guards two complementary actions on a command name guaranteed absent (with `cwd_mode="never"` for determinism), asserts the fallback action is present and the preferred action absent, and snapshots the Ninja output to `tests/snapshots/ninja`.
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Reviewer's GuideAdds a new deterministic Ninja snapshot test to validate File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Summary
Closes #310
Adds the snapshot test proposed in the issue:
command_available_manifest_ninja_snapshotintests/ninja_snapshot_tests.rs, following the structure ofconditional_manifest_ninja_snapshot.when: command_available("netsuke-command-that-should-not-exist", cwd_mode="never")and its negation, plus a simpletargetssection.manifest::from_str→BuildGraph::from_manifest→ninja_gen::generate.ensure!assertions confirm the fallback action is present and the preferred action absent.tests/snapshots/ninjaascommand_available_manifest_ninja; the committed.snapshows the fallback rule/build edge and the unconditional target, with nopreferredcontent.Deterministic with no real binary on
PATH(absent command name +cwd_mode="never").Validation
cargo test --test ninja_snapshot_tests— 4 passedmake check-fmt/make lint/make test— pass (37 suites)🤖 Generated with Claude Code
Summary by Sourcery
Tests: