mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-12-27 18:24:57 +00:00
Add tests for dot filters
This commit is contained in:
parent
bc5c0194b4
commit
0831573669
@ -141,7 +141,7 @@ mod test {
|
||||
use options::parser::{parse, Args, Arg};
|
||||
use std::ffi::OsString;
|
||||
|
||||
static TEST_ARGS: &[&Arg] = &[ &flags::SORT ];
|
||||
static TEST_ARGS: &[&Arg] = &[ &flags::SORT, &flags::ALL, &flags::TREE ];
|
||||
|
||||
let bits = $inputs.as_ref().into_iter().map(|&o| os(o)).collect::<Vec<OsString>>();
|
||||
let results = parse(&Args(TEST_ARGS), bits.iter());
|
||||
@ -170,4 +170,20 @@ mod test {
|
||||
test!(overridden: SortField <- ["--sort=cr", "--sort", "mod"] => Ok(SortField::ModifiedDate));
|
||||
test!(overridden_2: SortField <- ["--sort", "none", "--sort=Extension"] => Ok(SortField::Extension(SortCase::Insensitive)));
|
||||
}
|
||||
|
||||
|
||||
mod dot_filters {
|
||||
use super::*;
|
||||
|
||||
// Default behaviour
|
||||
test!(empty: DotFilter <- [] => Ok(DotFilter::JustFiles));
|
||||
|
||||
// --all
|
||||
test!(all: DotFilter <- ["--all"] => Ok(DotFilter::Dotfiles));
|
||||
test!(all_all: DotFilter <- ["--all", "-a"] => Ok(DotFilter::DotfilesAndDots));
|
||||
test!(all_all_2: DotFilter <- ["-aa"] => Ok(DotFilter::DotfilesAndDots));
|
||||
|
||||
// --all and --tree
|
||||
test!(tree: DotFilter <- ["-Taa"] => Err(Misfire::TreeAllAll));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user