MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_view_commands_variants

Function test_view_commands_variants

atomic-cli/src/commands/view/mod.rs:243–272  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

241
242 #[test]
243 fn test_view_commands_variants() {
244 // Ensure all variants exist and can be matched
245 fn check_variant(cmd: &ViewCommands) -> &'static str {
246 match cmd {
247 ViewCommands::Create(_) => "create",
248 ViewCommands::Split(_) => "split",
249 ViewCommands::Switch(_) => "switch",
250 ViewCommands::Delete(_) => "delete",
251 ViewCommands::List(_) => "list",
252 ViewCommands::Show(_) => "show",
253 ViewCommands::Promote(_) => "promote",
254 }
255 }
256
257 // Create instances of each variant
258 let new = New::default();
259 let switch = Switch::default();
260 let delete = Delete::default();
261 let list = List::default();
262 let show = Show::default();
263
264 let promote = Promote { name: None };
265
266 assert_eq!(check_variant(&ViewCommands::Create(new)), "create");
267 assert_eq!(check_variant(&ViewCommands::Switch(switch)), "switch");
268 assert_eq!(check_variant(&ViewCommands::Delete(delete)), "delete");
269 assert_eq!(check_variant(&ViewCommands::List(list)), "list");
270 assert_eq!(check_variant(&ViewCommands::Show(show)), "show");
271 assert_eq!(check_variant(&ViewCommands::Promote(promote)), "promote");
272 }
273}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected