MCPcopy Create free account
hub / github.com/dtormoen/tsk-tsk / test_copy_dir

Function test_copy_dir

src/file_system.rs:190–227  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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() {

Callers

nothing calls this directly

Calls 5

create_dirFunction · 0.85
write_fileFunction · 0.85
copy_dirFunction · 0.85
read_fileFunction · 0.85
pathMethod · 0.80

Tested by

no test coverage detected