()
| 188 | |
| 189 | #[tokio::test] |
| 190 | async fn test_copy_dir() { |
| 191 | let temp_dir = TempDir::new().unwrap(); |
| 192 | |
| 193 | let source_dir = temp_dir.path().join("source_dir"); |
| 194 | let dest_dir = temp_dir.path().join("dest_dir"); |
| 195 | |
| 196 | // Create source directory structure |
| 197 | create_dir(&source_dir).await.unwrap(); |
| 198 | write_file(&source_dir.join("file1.txt"), "content1") |
| 199 | .await |
| 200 | .unwrap(); |
| 201 | create_dir(&source_dir.join("subdir")).await.unwrap(); |
| 202 | write_file(&source_dir.join("subdir").join("file2.txt"), "content2") |
| 203 | .await |
| 204 | .unwrap(); |
| 205 | |
| 206 | // Copy directory |
| 207 | copy_dir(&source_dir, &dest_dir).await.unwrap(); |
| 208 | |
| 209 | // Verify structure |
| 210 | assert!(exists(&dest_dir).await.unwrap()); |
| 211 | assert!(exists(&dest_dir.join("file1.txt")).await.unwrap()); |
| 212 | assert!(exists(&dest_dir.join("subdir")).await.unwrap()); |
| 213 | assert!( |
| 214 | exists(&dest_dir.join("subdir").join("file2.txt")) |
| 215 | .await |
| 216 | .unwrap() |
| 217 | ); |
| 218 | |
| 219 | // Verify content |
| 220 | let content1 = read_file(&dest_dir.join("file1.txt")).await.unwrap(); |
| 221 | assert_eq!(content1, "content1"); |
| 222 | |
| 223 | let content2 = read_file(&dest_dir.join("subdir").join("file2.txt")) |
| 224 | .await |
| 225 | .unwrap(); |
| 226 | assert_eq!(content2, "content2"); |
| 227 | } |
| 228 | |
| 229 | #[tokio::test] |
| 230 | async fn test_copy_dir_with_symlinks() { |
nothing calls this directly
no test coverage detected