From 75061048a073acd6c245d9d1e87556b724a4afc7 Mon Sep 17 00:00:00 2001 From: overtrue Date: Fri, 10 Apr 2026 02:04:40 +0800 Subject: [PATCH] test(cli): cover object remove purge parser --- crates/cli/src/commands/mod.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/crates/cli/src/commands/mod.rs b/crates/cli/src/commands/mod.rs index 1c9532f..fdf690c 100644 --- a/crates/cli/src/commands/mod.rs +++ b/crates/cli/src/commands/mod.rs @@ -472,4 +472,27 @@ mod tests { other => panic!("expected bucket command, got {:?}", other), } } + + #[test] + fn cli_accepts_object_remove_with_purge_flag() { + let cli = Cli::try_parse_from([ + "rc", + "object", + "remove", + "local/my-bucket/object.txt", + "--purge", + ]) + .expect("parse object remove with purge"); + + match cli.command { + Commands::Object(args) => match args.command { + object::ObjectCommands::Remove(arg) => { + assert_eq!(arg.paths, vec!["local/my-bucket/object.txt".to_string()]); + assert!(arg.purge); + } + other => panic!("expected object remove command, got {:?}", other), + }, + other => panic!("expected object command, got {:?}", other), + } + } }