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

Function test_run_duplicate_view

atomic-cli/src/commands/view/new.rs:686–715  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

684 #[test]
685 #[serial]
686 fn test_run_duplicate_view() {
687 use tempfile::tempdir;
688
689 let _guard = DirGuard::new();
690 let temp = tempdir().unwrap();
691 let repo_path = temp.path();
692
693 // Initialize a repository and drop to release lock
694 {
695 let _repo = Repository::init(repo_path).unwrap();
696 }
697
698 // Change to the repo directory
699 std::env::set_current_dir(repo_path).unwrap();
700
701 // Create the view first time
702 let cmd = New::with_name("duplicate");
703 assert!(cmd.run().is_ok());
704
705 // Try to create it again
706 let cmd = New::with_name("duplicate");
707 let result = cmd.run();
708 assert!(result.is_err());
709 match result.unwrap_err() {
710 CliError::ViewAlreadyExists { name } => {
711 assert_eq!(name, "duplicate");
712 }
713 other => panic!("Expected ViewAlreadyExists, got: {:?}", other),
714 }
715 }
716
717 #[test]
718 #[serial]

Callers

nothing calls this directly

Calls 3

unwrapMethod · 0.45
pathMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected