KeiSeiKit-1.0/_primitives/_rust/kei-machine-probe/tests/cli_subcommands.rs
Parfii-bot a4e667de10 KeiSeiKit-public — clean state
Single-commit clean baseline after security scrub of niche-tells,
project codenames, internal jargon, and contributor-email leaks.

Contents:
- 100 Rust crates (_primitives/_rust/)
- 37 agent manifests (_manifests/) + generated specs (_generated/)
- 67 user-invocable skills (skills/)
- 33 hooks (hooks/)
- Composition blocks (_blocks/)
- Documentation (docs/, README.md)
- TS adapter packages (_ts_packages/)
- Assembler (_assembler/)
- Roles (_roles/)
- Templates (_templates/)
- Forgejo CI (.forgejo/)

Author: Denis Parfionovich <info@greendragon.info>

License: see LICENSE.
2026-05-01 12:09:03 +08:00

60 lines
1.6 KiB
Rust

//! clap parser shapes — each subcommand parses with required + optional flags.
use clap::Parser;
use kei_machine_probe::cli::{Cli, Cmd};
#[test]
fn probe_with_no_flags() {
let cli = Cli::try_parse_from(["kei-machine-probe", "probe"]).expect("probe");
match cli.cmd {
Cmd::Probe { mock_dir, no_tooling } => {
assert!(mock_dir.is_none());
assert!(!no_tooling);
}
_ => panic!("expected Probe"),
}
}
#[test]
fn probe_with_mock_dir_and_no_tooling() {
let cli = Cli::try_parse_from([
"kei-machine-probe",
"probe",
"--mock-dir",
"/tmp/fixtures",
"--no-tooling",
])
.expect("probe with flags");
match cli.cmd {
Cmd::Probe { mock_dir, no_tooling } => {
assert_eq!(mock_dir.as_deref().unwrap().to_str().unwrap(), "/tmp/fixtures");
assert!(no_tooling);
}
_ => panic!("expected Probe"),
}
}
#[test]
fn capabilities_parses() {
let cli =
Cli::try_parse_from(["kei-machine-probe", "capabilities"]).expect("capabilities");
matches!(cli.cmd, Cmd::Capabilities { .. });
}
#[test]
fn report_with_markdown_flag() {
let cli = Cli::try_parse_from(["kei-machine-probe", "report", "--markdown"])
.expect("report --markdown");
match cli.cmd {
Cmd::Report { mock_dir, markdown } => {
assert!(mock_dir.is_none());
assert!(markdown);
}
_ => panic!("expected Report"),
}
}
#[test]
fn unknown_subcommand_errors() {
assert!(Cli::try_parse_from(["kei-machine-probe", "garbage"]).is_err());
}