mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-05 02:55:31 +00:00
Fix cargo test
This commit is contained in:
parent
f9272b5ce5
commit
5b70940596
2
.gitignore
vendored
2
.gitignore
vendored
@ -2,6 +2,8 @@
|
||||
# will have compiled files and executables
|
||||
target/
|
||||
|
||||
makeshift_testing.py
|
||||
|
||||
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
|
||||
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
|
||||
Cargo.lock
|
||||
|
13
src/test.rs
13
src/test.rs
@ -86,23 +86,30 @@ mod argparsing {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_arg_parsing_decompress_subcommand() {
|
||||
fn test_arg_parsing_decompress_subcommand() -> crate::Result<()> {
|
||||
let files = vec!["a", "b", "c"];
|
||||
make_dummy_files(&*files)?;
|
||||
let files: Vec<_> = ["a", "b", "c"].iter().map(PathBuf::from).collect();
|
||||
|
||||
let expected = Command::Decompress {
|
||||
files: files.clone(),
|
||||
files: files.iter().filter_map(|p| fs::canonicalize(p).ok()).collect(),
|
||||
output_folder: None,
|
||||
};
|
||||
assert_eq!(expected, parse!("a b c").command);
|
||||
|
||||
let expected = Command::Decompress {
|
||||
files,
|
||||
files: files.iter().map(fs::canonicalize).map(Result::unwrap).collect(),
|
||||
output_folder: Some("folder".into()),
|
||||
};
|
||||
assert_eq!(expected, parse!("a b c --output folder").command);
|
||||
assert_eq!(expected, parse!("a b --output folder c").command);
|
||||
assert_eq!(expected, parse!("a --output folder b c").command);
|
||||
assert_eq!(expected, parse!("--output folder a b c").command);
|
||||
|
||||
fs::remove_file("a")?;
|
||||
fs::remove_file("b")?;
|
||||
fs::remove_file("c")?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user