mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-10-17 04:37:03 +00:00
Rename crate directories, package names, binary names, path dependencies, use statements, qualified paths, clap command names, and string literals across the workspace. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
66 lines
1.8 KiB
Rust
66 lines
1.8 KiB
Rust
use std::process::Command;
|
|
|
|
#[test]
|
|
fn no_args_prints_usage() {
|
|
let output = Command::new(env!("CARGO_BIN_EXE_arc-agent"))
|
|
.env_clear()
|
|
.output()
|
|
.expect("failed to execute");
|
|
|
|
assert!(!output.status.success());
|
|
let stderr = String::from_utf8_lossy(&output.stderr);
|
|
assert!(
|
|
stderr.contains("Usage:"),
|
|
"expected stderr to contain 'Usage:', got: {stderr}"
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn help_flag_prints_help() {
|
|
let output = Command::new(env!("CARGO_BIN_EXE_arc-agent"))
|
|
.env_clear()
|
|
.arg("--help")
|
|
.output()
|
|
.expect("failed to execute");
|
|
|
|
assert!(output.status.success());
|
|
let stdout = String::from_utf8_lossy(&output.stdout);
|
|
assert!(
|
|
stdout.contains("Task prompt"),
|
|
"expected stdout to contain 'Task prompt', got: {stdout}"
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn missing_api_key_exits_with_error() {
|
|
let tmp = std::env::temp_dir();
|
|
let output = Command::new(env!("CARGO_BIN_EXE_arc-agent"))
|
|
.env_clear()
|
|
.current_dir(&tmp)
|
|
.arg("test prompt")
|
|
.output()
|
|
.expect("failed to execute");
|
|
|
|
assert!(!output.status.success());
|
|
let stderr = String::from_utf8_lossy(&output.stderr);
|
|
assert!(
|
|
stderr.contains("API key not set"),
|
|
"expected stderr to contain 'API key not set', got: {stderr}"
|
|
);
|
|
}
|
|
|
|
#[test]
|
|
fn invalid_permissions_value() {
|
|
let output = Command::new(env!("CARGO_BIN_EXE_arc-agent"))
|
|
.env_clear()
|
|
.args(["--permissions", "bogus", "test prompt"])
|
|
.output()
|
|
.expect("failed to execute");
|
|
|
|
assert!(!output.status.success());
|
|
let stderr = String::from_utf8_lossy(&output.stderr);
|
|
assert!(
|
|
stderr.contains("invalid value"),
|
|
"expected stderr to contain 'invalid value', got: {stderr}"
|
|
);
|
|
}
|