From 0e3ed18947ed80dbe629d14ee728995327c49e4d Mon Sep 17 00:00:00 2001 From: overtrue Date: Wed, 15 Apr 2026 14:05:45 +0800 Subject: [PATCH] test(cli): cover noun-first stat and share help --- crates/cli/src/commands/mod.rs | 16 ++++++++++++++++ crates/cli/tests/help_contract.rs | 10 ++++++++++ 2 files changed, 26 insertions(+) diff --git a/crates/cli/src/commands/mod.rs b/crates/cli/src/commands/mod.rs index 1c9532f..4d5fe8b 100644 --- a/crates/cli/src/commands/mod.rs +++ b/crates/cli/src/commands/mod.rs @@ -472,4 +472,20 @@ mod tests { other => panic!("expected bucket command, got {:?}", other), } } + + #[test] + fn cli_accepts_object_stat_subcommand() { + let cli = Cli::try_parse_from(["rc", "object", "stat", "local/my-bucket/report.json"]) + .expect("parse object stat"); + + match cli.command { + Commands::Object(args) => match args.command { + object::ObjectCommands::Stat(arg) => { + assert_eq!(arg.path, "local/my-bucket/report.json"); + } + other => panic!("expected object stat command, got {:?}", other), + }, + other => panic!("expected object command, got {:?}", other), + } + } } diff --git a/crates/cli/tests/help_contract.rs b/crates/cli/tests/help_contract.rs index facf128..342227b 100644 --- a/crates/cli/tests/help_contract.rs +++ b/crates/cli/tests/help_contract.rs @@ -456,6 +456,16 @@ fn nested_subcommand_help_contract() { usage: "Usage: rc object show [OPTIONS] ", expected_tokens: &["--enc-key", "--rewind", "--version-id"], }, + HelpCase { + args: &["object", "stat"], + usage: "Usage: rc object stat [OPTIONS] ", + expected_tokens: &["--version-id", "--rewind"], + }, + HelpCase { + args: &["object", "share"], + usage: "Usage: rc object share [OPTIONS] ", + expected_tokens: &["--expire", "--upload", "--content-type"], + }, HelpCase { args: &["admin", "user", "info"], usage: "Usage: rc admin user info [OPTIONS] ",