mirror of
https://github.com/uutils/coreutils
synced 2024-12-13 23:02:38 +00:00
56 lines
1.1 KiB
Rust
56 lines
1.1 KiB
Rust
|
#[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 vdir use the same functions than ls, we don't have to retest them here.
|
||
|
* We just test the default and the column output
|
||
|
*/
|
||
|
|
||
|
#[test]
|
||
|
fn test_vdir() {
|
||
|
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_matches(&Regex::new("[rwx][^some-file1]").unwrap());
|
||
|
}
|
||
|
|
||
|
#[test]
|
||
|
fn test_column_output() {
|
||
|
let scene = TestScenario::new(util_name!());
|
||
|
let at = &scene.fixtures;
|
||
|
at.mkdir("some-dir1");
|
||
|
at.touch("some-file1");
|
||
|
|
||
|
scene
|
||
|
.ucmd()
|
||
|
.arg("-C")
|
||
|
.succeeds()
|
||
|
.stdout_contains("some-file1");
|
||
|
|
||
|
scene
|
||
|
.ucmd()
|
||
|
.arg("-C")
|
||
|
.succeeds()
|
||
|
.stdout_does_not_match(&Regex::new("[rwx][^some-file1]").unwrap());
|
||
|
}
|