mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
Add dir and vdir utils (based on ls)
Fix issue #3163 They are basically ls with some different options.
This commit is contained in:
parent
02bd97a00d
commit
c2e214bd99
18 changed files with 950 additions and 619 deletions
55
tests/by-util/test_dir.rs
Normal file
55
tests/by-util/test_dir.rs
Normal file
|
@ -0,0 +1,55 @@
|
|||
#[cfg(not(windows))]
|
||||
extern crate libc;
|
||||
extern crate regex;
|
||||
#[cfg(not(windows))]
|
||||
extern crate tempfile;
|
||||
#[cfg(unix)]
|
||||
extern crate unix_socket;
|
||||
|
||||
use self::regex::Regex;
|
||||
use crate::common::util::*;
|
||||
|
||||
/*
|
||||
* As dir use the same functions than ls, we don't have to retest them here.
|
||||
* We just test the default and the long output
|
||||
*/
|
||||
|
||||
#[test]
|
||||
fn test_dir() {
|
||||
new_ucmd!().succeeds();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_default_output() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
at.mkdir("some-dir1");
|
||||
at.touch("some-file1");
|
||||
|
||||
scene.ucmd().succeeds().stdout_contains("some-file1");
|
||||
|
||||
scene
|
||||
.ucmd()
|
||||
.succeeds()
|
||||
.stdout_does_not_match(&Regex::new("[rwx][^some-file1]").unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_long_output() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
at.mkdir("some-dir1");
|
||||
at.touch("some-file1");
|
||||
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("-l")
|
||||
.succeeds()
|
||||
.stdout_contains("some-file1");
|
||||
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("-l")
|
||||
.succeeds()
|
||||
.stdout_matches(&Regex::new("[rwx][^some-file1]").unwrap());
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue