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

Source from the content-addressed store, hash-verified

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