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

Source from the content-addressed store, hash-verified

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