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

Source from the content-addressed store, hash-verified

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