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