()
| 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() { |
nothing calls this directly
no test coverage detected