From f741a425077a62523d2577d828fb72fd42d041f2 Mon Sep 17 00:00:00 2001 From: YeonGyu-Kim Date: Thu, 9 Apr 2026 18:06:32 +0900 Subject: [PATCH] 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. --- rust/crates/rusty-claude-cli/src/main.rs | 54 +++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/rust/crates/rusty-claude-cli/src/main.rs b/rust/crates/rusty-claude-cli/src/main.rs index 9803532..4015dd0 100644 --- a/rust/crates/rusty-claude-cli/src/main.rs +++ b/rust/crates/rusty-claude-cli/src/main.rs @@ -8014,7 +8014,7 @@ mod tests { summarize_tool_payload_for_markdown, validate_no_args, write_mcp_server_fixture, CliAction, CliOutputFormat, CliToolExecutor, GitWorkspaceSummary, InternalPromptProgressEvent, InternalPromptProgressState, LiveCli, LocalHelpTopic, PromptHistoryEntry, SlashCommand, - StatusUsage, DEFAULT_MODEL, LATEST_SESSION_REFERENCE, + StatusUsage, DEFAULT_MODEL, LATEST_SESSION_REFERENCE, STUB_COMMANDS, }; use api::{ApiError, MessageResponse, OutputContentBlock, Usage}; use plugins::{ @@ -11160,6 +11160,58 @@ UU conflicted.rs", let _ = fs::remove_dir_all(source_root); std::env::remove_var("ANTHROPIC_API_KEY"); } + + #[test] + fn rejects_invalid_reasoning_effort_value() { + let err = parse_args(&[ + "--reasoning-effort".to_string(), + "turbo".to_string(), + "prompt".to_string(), + "hello".to_string(), + ]) + .unwrap_err(); + assert!( + err.contains("invalid value for --reasoning-effort"), + "unexpected error: {err}" + ); + assert!(err.contains("turbo"), "unexpected error: {err}"); + } + + #[test] + fn accepts_valid_reasoning_effort_values() { + for value in ["low", "medium", "high"] { + let result = parse_args(&[ + "--reasoning-effort".to_string(), + value.to_string(), + "prompt".to_string(), + "hello".to_string(), + ]); + assert!( + result.is_ok(), + "--reasoning-effort {value} should be accepted, got: {:?}", + result + ); + if let Ok(CliAction::Prompt { + reasoning_effort, .. + }) = result + { + assert_eq!(reasoning_effort.as_deref(), Some(value)); + } + } + } + + #[test] + fn stub_commands_absent_from_repl_completions() { + let candidates = + slash_command_completion_candidates_with_sessions("claude-3-5-sonnet", None, vec![]); + for stub in STUB_COMMANDS { + let with_slash = format!("/{stub}"); + assert!( + !candidates.contains(&with_slash), + "stub command {with_slash} should not appear in REPL completions" + ); + } + } } fn write_mcp_server_fixture(script_path: &Path) {