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

Function test_find_repository_root_not_found

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

Source from the content-addressed store, hash-verified

635
636 #[test]
637 fn test_find_repository_root_not_found() {
638 let temp = TempDir::new().unwrap();
639
640 // On some CI environments (especially Windows), a .atomic directory
641 // may exist somewhere above the temp dir in the filesystem hierarchy.
642 // Verify the precondition before asserting, and skip gracefully if not met.
643 let has_atomic_ancestor = {
644 let mut check = temp.path().to_path_buf();
645 let mut found = false;
646 loop {
647 if check.join(DOT_DIR).is_dir() {
648 found = true;
649 break;
650 }
651 if !check.pop() {
652 break;
653 }
654 }
655 found
656 };
657 if has_atomic_ancestor {
658 // A real .atomic dir exists above the temp dir; this test cannot
659 // reliably assert "not found" in this environment — skip it.
660 return;
661 }
662
663 let result = find_repository_root_from(temp.path());
664 assert!(result.is_err());
665 assert!(matches!(
666 result.unwrap_err(),
667 CliError::RepositoryNotFound { .. }
668 ));
669 }
670
671 #[test]
672 fn test_find_repository_root_in_current() {

Callers

nothing calls this directly

Calls 4

is_dirMethod · 0.80
unwrapMethod · 0.45
pathMethod · 0.45

Tested by

no test coverage detected