Skip to content

Commit

Permalink
fix the test failure for reviwing the archive files and update the codes
Browse files Browse the repository at this point in the history
  • Loading branch information
tamada committed May 1, 2024
1 parent 6222dfe commit 2565a24
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/extractor/tar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ fn list_tar<R: Read>(archive: &mut tar::Archive<R>) -> Result<Vec<String>> {
let mut result = Vec::<String>::new();
for entry in archive.entries().unwrap() {
let entry = entry.unwrap();
result.push(format!("{:?}", entry.header().path().unwrap()));
let path = entry.header().path().unwrap();
result.push(format!("{}", path.to_str().unwrap()));
}
Ok(result)
}
Expand All @@ -109,7 +110,7 @@ mod tests {
let file = PathBuf::from("testdata/test.tar");
match extractor.list_archives(file) {
Ok(r) => {
assert_eq!(r.len(), 18);
assert_eq!(r.len(), 16);
assert_eq!(r.get(0), Some("Cargo.toml".to_string()).as_ref());
assert_eq!(r.get(1), Some("build.rs".to_string()).as_ref());
assert_eq!(r.get(2), Some("LICENSE".to_string()).as_ref());
Expand All @@ -125,7 +126,7 @@ mod tests {
let file = PathBuf::from("testdata/test.tar.bz2");
match extractor.list_archives(file) {
Ok(r) => {
assert_eq!(r.len(), 18);
assert_eq!(r.len(), 16);
assert_eq!(r.get(0), Some("Cargo.toml".to_string()).as_ref());
assert_eq!(r.get(1), Some("build.rs".to_string()).as_ref());
assert_eq!(r.get(2), Some("LICENSE".to_string()).as_ref());
Expand All @@ -141,7 +142,7 @@ mod tests {
let file = PathBuf::from("testdata/test.tar.gz");
match extractor.list_archives(file) {
Ok(r) => {
assert_eq!(r.len(), 18);
assert_eq!(r.len(), 16);
assert_eq!(r.get(0), Some("Cargo.toml".to_string()).as_ref());
assert_eq!(r.get(1), Some("build.rs".to_string()).as_ref());
assert_eq!(r.get(2), Some("LICENSE".to_string()).as_ref());
Expand Down
2 changes: 1 addition & 1 deletion src/extractor/zip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ mod tests {
let file = PathBuf::from("testdata/test.zip");
match extractor.list_archives(file) {
Ok(r) => {
assert_eq!(r.len(), 18);
assert_eq!(r.len(), 19);
assert_eq!(r.get(0), Some("Cargo.toml".to_string()).as_ref());
assert_eq!(r.get(1), Some("build.rs".to_string()).as_ref());
assert_eq!(r.get(2), Some("LICENSE".to_string()).as_ref());
Expand Down
Binary file modified testdata/test.tar
Binary file not shown.
Binary file modified testdata/test.tar.bz2
Binary file not shown.
Binary file modified testdata/test.tar.gz
Binary file not shown.
Binary file modified testdata/test.zip
Binary file not shown.

0 comments on commit 2565a24

Please sign in to comment.