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

Function test_delete_current_view

atomic-cli/src/commands/view/delete.rs:316–341  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

314 #[test]
315 #[serial]
316 fn test_delete_current_view() {
317 use tempfile::tempdir;
318
319 let _guard = DirGuard::new();
320 let temp = tempdir().unwrap();
321 let repo_path = temp.path();
322
323 // Initialize a repository (current view is "dev") and drop to release lock
324 {
325 let _repo = Repository::init(repo_path).unwrap();
326 }
327
328 // Change to the repo directory
329 std::env::set_current_dir(repo_path).unwrap();
330
331 // Try to delete the current view
332 let cmd = Delete::with_name("dev");
333 let result = cmd.run();
334 assert!(result.is_err());
335 match result.unwrap_err() {
336 CliError::CannotDeleteCurrentView { name } => {
337 assert_eq!(name, "dev");
338 }
339 other => panic!("Expected CannotDeleteCurrentView, got: {:?}", other),
340 }
341 }
342
343 #[test]
344 #[serial]

Callers

nothing calls this directly

Calls 3

unwrapMethod · 0.45
pathMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected