huskies: merge 1034
This commit is contained in:
@@ -18,22 +18,14 @@ pub(super) fn handle_depends(ctx: &CommandContext) -> Option<String> {
|
||||
let args = ctx.args.trim();
|
||||
|
||||
if args.is_empty() {
|
||||
return Some(format!(
|
||||
"Usage: `{} depends <number> [dep1 dep2 ...]`\n\nExamples:\n\
|
||||
• `{0} depends 484 477 478` — set depends_on: [477, 478]\n\
|
||||
• `{0} depends 484` — clear all dependencies",
|
||||
ctx.services.bot_name
|
||||
));
|
||||
return None;
|
||||
}
|
||||
|
||||
let mut parts = args.split_whitespace();
|
||||
let num_str = parts.next().unwrap_or("");
|
||||
|
||||
if !num_str.chars().all(|c| c.is_ascii_digit()) || num_str.is_empty() {
|
||||
return Some(format!(
|
||||
"Invalid story number: `{num_str}`. Usage: `{} depends <number> [dep1 dep2 ...]`",
|
||||
ctx.services.bot_name
|
||||
));
|
||||
if num_str.is_empty() || !num_str.chars().all(|c| c.is_ascii_digit()) {
|
||||
return None;
|
||||
}
|
||||
|
||||
// Parse dependency numbers.
|
||||
@@ -129,22 +121,32 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn depends_no_args_returns_usage() {
|
||||
fn depends_no_args_routes_to_timmy() {
|
||||
let tmp = tempfile::TempDir::new().unwrap();
|
||||
let output = depends_cmd_with_root(tmp.path(), "").unwrap();
|
||||
let result = depends_cmd_with_root(tmp.path(), "");
|
||||
assert!(
|
||||
output.contains("Usage"),
|
||||
"no args should show usage: {output}"
|
||||
result.is_none(),
|
||||
"no args should route to LLM (None): {result:?}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn depends_non_numeric_number_returns_error() {
|
||||
fn depends_non_numeric_number_routes_to_timmy() {
|
||||
let tmp = tempfile::TempDir::new().unwrap();
|
||||
let output = depends_cmd_with_root(tmp.path(), "abc 1 2").unwrap();
|
||||
let result = depends_cmd_with_root(tmp.path(), "on 477 and 478");
|
||||
assert!(
|
||||
output.contains("Invalid story number"),
|
||||
"non-numeric story number should error: {output}"
|
||||
result.is_none(),
|
||||
"natural-language args should route to LLM (None): {result:?}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn depends_well_formed_runs_handler() {
|
||||
let tmp = tempfile::TempDir::new().unwrap();
|
||||
let result = depends_cmd_with_root(tmp.path(), "999");
|
||||
assert!(
|
||||
result.is_some(),
|
||||
"well-formed numeric story number should run the command handler: {result:?}"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user