(dir: &Descriptor)
| 36 | } |
| 37 | |
| 38 | async fn test_readdir(dir: &Descriptor) { |
| 39 | // Check the behavior in an empty directory |
| 40 | assert_empty_dir(dir).await; |
| 41 | |
| 42 | dir.open_at( |
| 43 | PathFlags::empty(), |
| 44 | "file".to_string(), |
| 45 | OpenFlags::CREATE, |
| 46 | DescriptorFlags::READ | DescriptorFlags::WRITE, |
| 47 | ) |
| 48 | .await |
| 49 | .unwrap(); |
| 50 | |
| 51 | dir.create_directory_at("nested".to_string()).await.unwrap(); |
| 52 | let nested = dir |
| 53 | .open_at( |
| 54 | PathFlags::empty(), |
| 55 | "nested".to_string(), |
| 56 | OpenFlags::DIRECTORY, |
| 57 | DescriptorFlags::empty(), |
| 58 | ) |
| 59 | .await |
| 60 | .unwrap(); |
| 61 | |
| 62 | let entries = read_dir(dir).await; |
| 63 | assert_eq!(entries.len(), 2); |
| 64 | assert_eq!(entries[0].name, "file"); |
| 65 | assert!(matches!(entries[0].type_, DescriptorType::RegularFile)); |
| 66 | assert_eq!(entries[1].name, "nested"); |
| 67 | assert!(matches!(entries[1].type_, DescriptorType::Directory)); |
| 68 | |
| 69 | assert_empty_dir(&nested).await; |
| 70 | drop(nested); |
| 71 | |
| 72 | dir.unlink_file_at("file".to_string()).await.unwrap(); |
| 73 | dir.remove_directory_at("nested".to_string()).await.unwrap(); |
| 74 | } |
| 75 | |
| 76 | async fn test_readdir_lots(dir: &Descriptor) { |
| 77 | for count in 0..1000 { |
no test coverage detected