-
Notifications
You must be signed in to change notification settings - Fork 0
Builtin verbs always builtin on runner, task-or-builtin on run
#55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,131 @@ | ||
| //! Integration coverage for the builtin-verb dispatch split. | ||
| //! | ||
| //! The explicit `runner <verb>` subcommand is ALWAYS the builtin — a | ||
| //! same-named project task never shadows it. The run path (`run <verb>` / | ||
| //! `runner run <verb>`) runs a same-named task when one exists, else falls | ||
| //! back to the builtin's default (no-flag) form. | ||
| //! | ||
| //! `list` is the exercise verb here: its builtin is cheap (renders the task | ||
| //! list, spawns nothing), unlike `install`/`clean` which would shell out to | ||
| //! real package managers. The fallback helper is verb-agnostic, so proving | ||
| //! `list` exercises the same code path that serves every builtin verb. | ||
| //! | ||
| //! Fixtures use `just`; if it's not on PATH the assertions are skipped | ||
| //! rather than failing, matching `info_deprecation.rs`. | ||
|
|
||
| use std::path::PathBuf; | ||
| use std::process::Command; | ||
|
|
||
| fn runner_binary() -> PathBuf { | ||
| PathBuf::from(env!("CARGO_BIN_EXE_runner")) | ||
| } | ||
|
|
||
| fn run_binary() -> PathBuf { | ||
| PathBuf::from(env!("CARGO_BIN_EXE_run")) | ||
| } | ||
|
|
||
| fn fixture(name: &str) -> PathBuf { | ||
| PathBuf::from(env!("CARGO_MANIFEST_DIR")) | ||
| .join("tests/fixtures") | ||
| .join(name) | ||
| } | ||
|
|
||
| fn just_available() -> bool { | ||
| Command::new("just") | ||
| .arg("--version") | ||
| .output() | ||
| .is_ok_and(|o| o.status.success()) | ||
| } | ||
|
|
||
| #[test] | ||
| fn runner_list_is_always_builtin_even_with_a_list_task() { | ||
| if !just_available() { | ||
| eprintln!("skipping: `just` not found on PATH"); | ||
| return; | ||
| } | ||
| // A project task named `list` does NOT shadow the explicit subcommand. | ||
| let output = Command::new(runner_binary()) | ||
| .args(["--dir", fixture("list-shadowed").to_str().unwrap(), "list"]) | ||
| .output() | ||
| .expect("runner binary spawns"); | ||
|
|
||
| assert!(output.status.success(), "`runner list` should exit 0"); | ||
| let stdout = String::from_utf8_lossy(&output.stdout); | ||
| assert!( | ||
| !stdout.contains("project-list-recipe-ran"), | ||
| "the project `list` recipe must NOT run for the explicit subcommand. stdout: {stdout}", | ||
| ); | ||
| // Builtin list shape: the recipe names appear as listed tasks. | ||
| assert!( | ||
| stdout.contains("list") && stdout.contains("build"), | ||
| "expected the justfile recipes in the builtin list output. stdout: {stdout}", | ||
| ); | ||
| } | ||
|
|
||
| #[test] | ||
| fn run_list_runs_a_same_named_task() { | ||
| if !just_available() { | ||
| eprintln!("skipping: `just` not found on PATH"); | ||
| return; | ||
| } | ||
| let dir = fixture("list-shadowed"); | ||
| let dir = dir.to_str().unwrap(); | ||
| let invocations: [(&str, PathBuf, Vec<&str>); 2] = [ | ||
| ("run list", run_binary(), vec!["--dir", dir, "list"]), | ||
| ( | ||
| "runner run list", | ||
| runner_binary(), | ||
| vec!["--dir", dir, "run", "list"], | ||
| ), | ||
| ]; | ||
| for (label, binary, args) in invocations { | ||
| let output = Command::new(binary) | ||
| .args(&args) | ||
| .output() | ||
| .expect("binary spawns"); | ||
|
|
||
| assert!(output.status.success(), "`{label}` should exit 0"); | ||
| let stdout = String::from_utf8_lossy(&output.stdout); | ||
| assert!( | ||
| stdout.contains("project-list-recipe-ran"), | ||
| "`{label}` should run the project `list` recipe. stdout: {stdout}", | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| #[test] | ||
| fn run_list_falls_back_to_builtin_when_no_task() { | ||
| if !just_available() { | ||
| eprintln!("skipping: `just` not found on PATH"); | ||
| return; | ||
| } | ||
| // `info-deprecated` defines `build`/`test` but no `list` task, so the | ||
| // run path falls back to the builtin list (rather than the PM-exec | ||
| // path, which would try to spawn a bare `list` binary and fail). | ||
| let dir = fixture("info-deprecated"); | ||
| let dir = dir.to_str().unwrap(); | ||
| for (label, binary, args) in [ | ||
| ("run list", run_binary(), vec!["--dir", dir, "list"]), | ||
| ( | ||
| "runner run list", | ||
| runner_binary(), | ||
| vec!["--dir", dir, "run", "list"], | ||
| ), | ||
| ] { | ||
| let output = Command::new(binary) | ||
| .args(&args) | ||
| .output() | ||
| .expect("binary spawns"); | ||
|
|
||
| assert!( | ||
| output.status.success(), | ||
| "`{label}` should fall back to the builtin list and exit 0. stderr: {}", | ||
| String::from_utf8_lossy(&output.stderr), | ||
| ); | ||
| let stdout = String::from_utf8_lossy(&output.stdout); | ||
| assert!( | ||
| stdout.contains("build") && stdout.contains("test"), | ||
| "`{label}` builtin-list fallback should render the justfile tasks. stdout: {stdout}", | ||
| ); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| list: | ||
| @echo "project-list-recipe-ran" | ||
|
|
||
| build: | ||
| @echo "build-ran" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahoy! Ye be needin' a new version section header in th' CHANGELOG, ye scallywag!
Accordin' to th' coding guidelines, when a version bump be detected (and 'tis detected, from 0.13.1 to 0.14.0 in Cargo.toml), th' CHANGELOG.md MUST contain a new section header in th' exact format:
## [X.Y.Z] - YYYY-MM-DD. Right now, all th' changes be sittin' under## [Unreleased], which be a grievous violation of th' code of th' seas—er, guidelines.Ye need to create a new section
## [0.14.0] - YYYY-MM-DD(with th' actual release date) and move these entries there. After that, keep th'## [Unreleased]section for future changes.⚓ Proposed fix to add proper version header
🤖 Prompt for AI Agents
Source: Coding guidelines