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:313–338  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

unwrapMethod · 0.45
pathMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected