Skip to content

Commit

Permalink
Merge pull request #5 from acridotheres/rustfmt-7438d4af9f012119f5827…
Browse files Browse the repository at this point in the history
…d6fc718fdf4f8de08a1

Format code using rustfmt for 7438d4a
  • Loading branch information
Le0X8 authored Jul 12, 2024
2 parents 7438d4a + 370d099 commit cc4f1ce
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/formats/zip/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ fn read_local_files(file: &mut File) -> (Vec<ZipFileEntry>, u32) {
});
file.jump(size_compressed as i128);
signature = file.read_u32le();
};
}

(files, signature)
}
2 changes: 1 addition & 1 deletion src/helpers.rs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pub mod datetime;
pub mod datetime;
2 changes: 1 addition & 1 deletion src/helpers/datetime.rs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pub mod msdos;
pub mod msdos;
17 changes: 13 additions & 4 deletions tests/zip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ fn metadata_000() {
assert_eq!(metadata.files[0].file.size, 14);
assert_eq!(metadata.files[0].compression, "stored");
assert_eq!(metadata.files[0].uncompressed_size, 14);
assert_eq!(metadata.files[0].file.modified.to_rfc3339(), "2024-07-11T18:14:42+00:00");
assert_eq!(
metadata.files[0].file.modified.to_rfc3339(),
"2024-07-11T18:14:42+00:00"
);
//println!("{:#?}", metadata);

let test_txt = corelib::formats::zip::parser::get_file(&mut file, &metadata.files[0]);
Expand All @@ -27,15 +30,21 @@ fn metadata_001() {
assert_eq!(metadata.files[0].file.size, 14);
assert_eq!(metadata.files[0].compression, "stored");
assert_eq!(metadata.files[0].uncompressed_size, 14);
assert_eq!(metadata.files[0].file.modified.to_rfc3339(), "2024-07-12T18:11:08+00:00");
assert_eq!(
metadata.files[0].file.modified.to_rfc3339(),
"2024-07-12T18:11:08+00:00"
);
assert_eq!(metadata.files[1].file.path, "test2.txt");
assert_eq!(metadata.files[1].file.size, 16);
assert_eq!(metadata.files[1].compression, "stored");
assert_eq!(metadata.files[1].uncompressed_size, 16);
assert_eq!(metadata.files[1].file.modified.to_rfc3339(), "2024-07-12T18:11:26+00:00");
assert_eq!(
metadata.files[1].file.modified.to_rfc3339(),
"2024-07-12T18:11:26+00:00"
);

let test_txt = corelib::formats::zip::parser::get_file(&mut file, &metadata.files[0]);
assert_eq!(String::from_utf8(test_txt).unwrap(), "Hello, world!\n");
let test2_txt = corelib::formats::zip::parser::get_file(&mut file, &metadata.files[1]);
assert_eq!(String::from_utf8(test2_txt).unwrap(), "Hello, world! 2\n");
}
}

0 comments on commit cc4f1ce

Please sign in to comment.