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

Source from the content-addressed store, hash-verified

621
622 #[test]
623 fn test_find_repository_root_not_found() {
624 let temp = TempDir::new().unwrap();
625
626 // On some CI environments (especially Windows), a .atomic directory
627 // may exist somewhere above the temp dir in the filesystem hierarchy.
628 // Verify the precondition before asserting, and skip gracefully if not met.
629 let has_atomic_ancestor = {
630 let mut check = temp.path().to_path_buf();
631 let mut found = false;
632 loop {
633 if check.join(DOT_DIR).is_dir() {
634 found = true;
635 break;
636 }
637 if !check.pop() {
638 break;
639 }
640 }
641 found
642 };
643 if has_atomic_ancestor {
644 // A real .atomic dir exists above the temp dir; this test cannot
645 // reliably assert "not found" in this environment — skip it.
646 return;
647 }
648
649 let result = find_repository_root_from(temp.path());
650 assert!(result.is_err());
651 assert!(matches!(
652 result.unwrap_err(),
653 CliError::RepositoryNotFound { .. }
654 ));
655 }
656
657 #[test]
658 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