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

Source from the content-addressed store, hash-verified

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