Skip to content

Commit f741a42

Browse files
committed
test(cli): add regression coverage for reasoning-effort validation and stub-command filtering
3 new tests in mod tests: - rejects_invalid_reasoning_effort_value: confirms 'turbo' etc rejected at parse time - accepts_valid_reasoning_effort_values: confirms low/medium/high accepted and threaded - stub_commands_absent_from_repl_completions: asserts STUB_COMMANDS are not in completions 156 -> 159 CLI tests pass.
1 parent 6b3e2d8 commit f741a42

1 file changed

Lines changed: 53 additions & 1 deletion

File tree

  • rust/crates/rusty-claude-cli/src

rust/crates/rusty-claude-cli/src/main.rs

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8014,7 +8014,7 @@ mod tests {
80148014
summarize_tool_payload_for_markdown, validate_no_args, write_mcp_server_fixture, CliAction,
80158015
CliOutputFormat, CliToolExecutor, GitWorkspaceSummary, InternalPromptProgressEvent,
80168016
InternalPromptProgressState, LiveCli, LocalHelpTopic, PromptHistoryEntry, SlashCommand,
8017-
StatusUsage, DEFAULT_MODEL, LATEST_SESSION_REFERENCE,
8017+
StatusUsage, DEFAULT_MODEL, LATEST_SESSION_REFERENCE, STUB_COMMANDS,
80188018
};
80198019
use api::{ApiError, MessageResponse, OutputContentBlock, Usage};
80208020
use plugins::{
@@ -11160,6 +11160,58 @@ UU conflicted.rs",
1116011160
let _ = fs::remove_dir_all(source_root);
1116111161
std::env::remove_var("ANTHROPIC_API_KEY");
1116211162
}
11163+
11164+
#[test]
11165+
fn rejects_invalid_reasoning_effort_value() {
11166+
let err = parse_args(&[
11167+
"--reasoning-effort".to_string(),
11168+
"turbo".to_string(),
11169+
"prompt".to_string(),
11170+
"hello".to_string(),
11171+
])
11172+
.unwrap_err();
11173+
assert!(
11174+
err.contains("invalid value for --reasoning-effort"),
11175+
"unexpected error: {err}"
11176+
);
11177+
assert!(err.contains("turbo"), "unexpected error: {err}");
11178+
}
11179+
11180+
#[test]
11181+
fn accepts_valid_reasoning_effort_values() {
11182+
for value in ["low", "medium", "high"] {
11183+
let result = parse_args(&[
11184+
"--reasoning-effort".to_string(),
11185+
value.to_string(),
11186+
"prompt".to_string(),
11187+
"hello".to_string(),
11188+
]);
11189+
assert!(
11190+
result.is_ok(),
11191+
"--reasoning-effort {value} should be accepted, got: {:?}",
11192+
result
11193+
);
11194+
if let Ok(CliAction::Prompt {
11195+
reasoning_effort, ..
11196+
}) = result
11197+
{
11198+
assert_eq!(reasoning_effort.as_deref(), Some(value));
11199+
}
11200+
}
11201+
}
11202+
11203+
#[test]
11204+
fn stub_commands_absent_from_repl_completions() {
11205+
let candidates =
11206+
slash_command_completion_candidates_with_sessions("claude-3-5-sonnet", None, vec![]);
11207+
for stub in STUB_COMMANDS {
11208+
let with_slash = format!("/{stub}");
11209+
assert!(
11210+
!candidates.contains(&with_slash),
11211+
"stub command {with_slash} should not appear in REPL completions"
11212+
);
11213+
}
11214+
}
1116311215
}
1116411216

1116511217
fn write_mcp_server_fixture(script_path: &Path) {

0 commit comments

Comments
 (0)