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

Source from the content-addressed store, hash-verified

735
736 #[test]
737 fn test_find_repository_root_not_found() {
738 let temp = TempDir::new().unwrap();
739
740 // On some CI environments (especially Windows), a .atomic directory
741 // may exist somewhere above the temp dir in the filesystem hierarchy.
742 // Verify the precondition before asserting, and skip gracefully if not met.
743 let has_atomic_ancestor = {
744 let mut check = temp.path().to_path_buf();
745 let mut found = false;
746 loop {
747 if atomic_repository::has_database(&check.join(DOT_DIR))
748 || check.join(SANDBOX_POINTER).is_file()
749 {
750 found = true;
751 break;
752 }
753 if !check.pop() {
754 break;
755 }
756 }
757 found
758 };
759 if has_atomic_ancestor {
760 // A real .atomic dir exists above the temp dir; this test cannot
761 // reliably assert "not found" in this environment — skip it.
762 return;
763 }
764
765 let result = find_repository_root_from(temp.path());
766 assert!(result.is_err());
767 assert!(matches!(
768 result.unwrap_err(),
769 CliError::RepositoryNotFound { .. }
770 ));
771 }
772
773 #[test]
774 fn test_find_repository_root_in_current() {

Callers

nothing calls this directly

Calls 5

has_databaseFunction · 0.85
unwrapMethod · 0.45
pathMethod · 0.45
is_fileMethod · 0.45

Tested by

no test coverage detected