Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/discover/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1222,9 +1222,10 @@ mod tests {

#[test]
fn test_registry_covers_all_cargo_subcommands() {
// Verify that every CargoCommand variant (Build, Test, Clippy, Check, Fmt)
// except Other has a matching pattern in the registry
for subcmd in ["build", "test", "clippy", "check", "fmt"] {
// Verify that every CargoCommand variant except Other has a matching pattern in the registry.
for subcmd in [
"build", "test", "clippy", "check", "fmt", "install", "nextest",
] {
let cmd = format!("cargo {subcmd}");
match classify_command(&cmd) {
Classification::Supported { .. } => {}
Expand Down Expand Up @@ -1403,6 +1404,14 @@ mod tests {
);
}

#[test]
fn test_rewrite_cargo_nextest_run() {
assert_eq!(
rewrite_command_no_prefixes("cargo nextest run", &[]),
Some("rtk cargo nextest run".into())
);
}

#[test]
fn test_rewrite_compound_and() {
assert_eq!(
Expand Down
4 changes: 2 additions & 2 deletions src/discover/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ pub const RULES: &[RtkRule] = &[
subcmd_status: &[],
},
RtkRule {
pattern: r"^cargo\s+(build|test|clippy|check|fmt|install)",
pattern: r"^cargo\s+(build|test|nextest|clippy|check|fmt|install)",
rtk_cmd: "rtk cargo",
rewrite_prefixes: &["cargo"],
category: "Cargo",
savings_pct: 80.0,
subcmd_savings: &[("test", 90.0), ("check", 80.0)],
subcmd_savings: &[("test", 90.0), ("nextest", 90.0), ("check", 80.0)],
subcmd_status: &[("fmt", RtkStatus::Passthrough)],
},
RtkRule {
Expand Down