diff --git a/makeshift_testing.py b/makeshift_testing.py index 63d429a..08fe5b1 100755 --- a/makeshift_testing.py +++ b/makeshift_testing.py @@ -12,9 +12,9 @@ def make_random_file(): def sanity_check_format(format: str): make_random_file() md5sum = hashlib.md5(open('test-file', 'rb').read()).hexdigest() - os.system(f"cargo run -- -i test-file -o test-file.{format}") + os.system(f"cargo run -- compress test-file test-file.{format}") os.remove('test-file') - os.system(f"cargo run -- -i test-file.{format}") + os.system(f"cargo run -- test-file.{format}") if md5sum != hashlib.md5(open('test-file', 'rb').read()).hexdigest(): print("Something went wrong with tar (de)compression.") os._exit(2) @@ -81,16 +81,16 @@ if __name__ == "__main__": print(f"Failed while decompressing {file}") os._exit(2) - # os.chdir("..") - # os.system("rm -rf testbuilds") + os.chdir("..") + os.system("rm -rf testbuilds") - # # We'll now verify if ouch is not altering the data it is compressing - # # and decompressing + # We'll now verify if ouch is not altering the data it is compressing + # and decompressing - # sanity_check_format("zip") - # sanity_check_format("tar") - # sanity_check_format("tar.gz") - # sanity_check_format("tar.bz") - # sanity_check_format("tar.bz2") - # sanity_check_format("tar.lz") - # sanity_check_format("tar.lzma") \ No newline at end of file + sanity_check_format("zip") + sanity_check_format("tar") + sanity_check_format("tar.gz") + sanity_check_format("tar.bz") + sanity_check_format("tar.bz2") + sanity_check_format("tar.lz") + sanity_check_format("tar.lzma") \ No newline at end of file diff --git a/src/evaluator.rs b/src/evaluator.rs index a4986b6..8d01625 100644 --- a/src/evaluator.rs +++ b/src/evaluator.rs @@ -19,7 +19,8 @@ use crate::{ dialogs::Confirmation, extension::{CompressionFormat, Extension}, file::File, - utils + utils, + debug }; pub struct Evaluator {} @@ -213,7 +214,7 @@ impl Evaluator { output: Option<&Path>, flags: &oof::Flags, ) -> crate::Result<()> { - let file = File::from(file_path)?; + let file = debug!(File::from(file_path)?); let output = match output { Some(inner) => Some(File::from(inner)?), None => None, diff --git a/src/extension.rs b/src/extension.rs index f8a4029..bb23dc8 100644 --- a/src/extension.rs +++ b/src/extension.rs @@ -7,7 +7,7 @@ use std::{ use CompressionFormat::*; -use crate::utils::to_utf; +use crate::{debug, utils::to_utf}; /// Represents the extension of a file, but only really caring about /// compression formats (and .tar). diff --git a/src/file.rs b/src/file.rs index 56d2c26..bf29016 100644 --- a/src/file.rs +++ b/src/file.rs @@ -19,13 +19,12 @@ pub struct File<'a> { impl<'a> File<'a> { pub fn from(path: &'a Path) -> crate::Result { - let extension = Extension::from(path.as_ref())?; - eprintln!("dev warning: Should we really ignore the errors from the convertion above?"); + let extension = Extension::from(path.as_ref()).ok(); Ok(File { path, contents_in_memory: None, - extension: Some(extension), + extension }) } }