From d515e20a26cc959db912504706189ad1cce9dbfa Mon Sep 17 00:00:00 2001 From: Igor Tolmachev Date: Sun, 14 Jul 2024 17:15:24 +0900 Subject: Add file indexation --- tests/zip.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'tests/zip.rs') diff --git a/tests/zip.rs b/tests/zip.rs index b9291fc..1e919d3 100644 --- a/tests/zip.rs +++ b/tests/zip.rs @@ -15,7 +15,7 @@ fn test_zip() { vec!["bzip", "deflate", "lzma", "store", "xz", "zstd"] ); - let mut f = archive.get_file_reader("store").unwrap(); + let mut f = archive.get_file_reader_by_name("store").unwrap(); let mut data = String::new(); f.read_to_string(&mut data).unwrap(); @@ -48,14 +48,8 @@ fn test_zip() { assert_eq!(f.seek(SeekFrom::Start(100)).unwrap(), 14); - for name in archive - .files() - .iter() - .map(|f| f.name.clone()) - .collect::>() - { - let mut f = archive.get_file_reader(&name).unwrap(); - + for index in 0..archive.len() { + let mut f = archive.get_file_reader_by_index(index).unwrap(); let mut data = String::new(); f.read_to_string(&mut data).unwrap(); assert_eq!(data, "test file data"); -- cgit v1.2.3