-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from tamada/lha+zstd
add features to extract lha/lzh and zstd
- Loading branch information
Showing
11 changed files
with
353 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use crate::archiver::{Archiver, Format, ArchiverOpts}; | ||
use crate::cli::{ToteError, Result}; | ||
|
||
pub(super) struct LhaArchiver { | ||
} | ||
|
||
impl Archiver for LhaArchiver { | ||
fn perform(&self, _: &ArchiverOpts) -> Result<()> { | ||
Err(ToteError::UnsupportedFormat("only extraction support for lha".to_string())) | ||
} | ||
fn format(&self) -> Format { | ||
Format::LHA | ||
} | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
|
||
use std::path::PathBuf; | ||
use crate::verboser::create_verboser; | ||
|
||
#[test] | ||
fn test_format() { | ||
let archiver = LhaArchiver{}; | ||
assert_eq!(archiver.format(), Format::LHA); | ||
} | ||
|
||
#[test] | ||
fn test_archive() { | ||
let archiver = LhaArchiver{}; | ||
let opts = ArchiverOpts { | ||
dest: PathBuf::from("results/test.rar"), | ||
targets: vec![], | ||
overwrite: false, | ||
recursive: false, | ||
v: create_verboser(false), | ||
}; | ||
let r = archiver.perform(&opts); | ||
assert!(r.is_err()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.