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

Source from the content-addressed store, hash-verified

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