mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
du: update du to use parse_glob::from_str
This commit is contained in:
parent
898689d924
commit
c2bb9596d9
2 changed files with 40 additions and 1 deletions
|
@ -747,6 +747,40 @@ fn test_du_exclude_mix() {
|
|||
assert!(result.stdout_str().contains("xcwww"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
// Disable on Windows because we are looking for /
|
||||
// And the tests would be more complex if we have to support \ too
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
fn test_du_complex_exclude_patterns() {
|
||||
let ts = TestScenario::new(util_name!());
|
||||
let at = &ts.fixtures;
|
||||
|
||||
at.mkdir_all("azerty/xcwww/azeaze");
|
||||
at.mkdir_all("azerty/xcwww/qzerty");
|
||||
at.mkdir_all("azerty/xcwww/amazing");
|
||||
|
||||
// Negation in glob should work with both ^ and !
|
||||
let result = ts
|
||||
.ucmd()
|
||||
.arg("--exclude=azerty/*/[^q]*")
|
||||
.arg("azerty")
|
||||
.succeeds();
|
||||
assert!(!result.stdout_str().contains("amazing"));
|
||||
assert!(result.stdout_str().contains("qzerty"));
|
||||
assert!(!result.stdout_str().contains("azeaze"));
|
||||
assert!(result.stdout_str().contains("xcwww"));
|
||||
|
||||
let result = ts
|
||||
.ucmd()
|
||||
.arg("--exclude=azerty/*/[!q]*")
|
||||
.arg("azerty")
|
||||
.succeeds();
|
||||
assert!(!result.stdout_str().contains("amazing"));
|
||||
assert!(result.stdout_str().contains("qzerty"));
|
||||
assert!(!result.stdout_str().contains("azeaze"));
|
||||
assert!(result.stdout_str().contains("xcwww"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_du_exclude_several_components() {
|
||||
let ts = TestScenario::new(util_name!());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue