Skip to content

Commit

Permalink
Merge pull request #3 from dottorblaster/unit-test-archive-creation
Browse files Browse the repository at this point in the history
Unit test archive creation
  • Loading branch information
dottorblaster authored Nov 22, 2024
2 parents 461e03a + b4be481 commit 413f21e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/tarballs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,23 @@ pub fn recompress(

Ok(())
}

#[cfg(test)]
mod tests {
use super::*;
use std::fs;

#[test]
fn recompress_successful() {
let result = recompress("vendor.tar.gz", "test/test_compression", "gz");
fs::remove_file("vendor.tar.gz").unwrap();
assert!(result.is_ok());
}

#[test]
fn recompress_error() {
let result = recompress("vendor2.tar.gz", "test/carbonara", "gz");
fs::remove_file("vendor2.tar.gz").unwrap();
assert!(result.is_err());
}
}
1 change: 1 addition & 0 deletions test/test_compression/deps/sample.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sample file content

0 comments on commit 413f21e

Please sign in to comment.