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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

unwrapMethod · 0.45
pathMethod · 0.45
runMethod · 0.45

Tested by

no test coverage detected