mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
rustfmt the recent change
This commit is contained in:
parent
d0c7e8c09e
commit
c5b43c0994
10 changed files with 43 additions and 32 deletions
|
@ -144,7 +144,9 @@ fn check_option(matches: &ArgMatches, name: &str) -> Result<BufferType, ProgramO
|
|||
Some(value) => match value {
|
||||
"L" => {
|
||||
if name == options::INPUT {
|
||||
Err(ProgramOptionsError("line buffering stdin is meaningless".to_string()))
|
||||
Err(ProgramOptionsError(
|
||||
"line buffering stdin is meaningless".to_string(),
|
||||
))
|
||||
} else {
|
||||
Ok(BufferType::Line)
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ fn next_tabstop(tabstops: &[usize], col: usize) -> Option<usize> {
|
|||
} else {
|
||||
// find next larger tab
|
||||
// if there isn't one in the list, tab becomes a single space
|
||||
tabstops.iter().find(|&&t| t > col).map(|t| t-col)
|
||||
tabstops.iter().find(|&&t| t > col).map(|t| t - col)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -357,7 +357,8 @@ fn test_chmod_symlink_non_existing_file() {
|
|||
at.symlink_file(non_existing, test_symlink);
|
||||
|
||||
// this cannot succeed since the symbolic link dangles
|
||||
scene.ucmd()
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("755")
|
||||
.arg("-v")
|
||||
.arg(test_symlink)
|
||||
|
@ -367,7 +368,8 @@ fn test_chmod_symlink_non_existing_file() {
|
|||
.stderr_contains(expected_stderr);
|
||||
|
||||
// this should be the same than with just '-v' but without stderr
|
||||
scene.ucmd()
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("755")
|
||||
.arg("-v")
|
||||
.arg("-f")
|
||||
|
@ -394,7 +396,8 @@ fn test_chmod_symlink_non_existing_file_recursive() {
|
|||
);
|
||||
|
||||
// this should succeed
|
||||
scene.ucmd()
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("-R")
|
||||
.arg("755")
|
||||
.arg(test_directory)
|
||||
|
@ -408,7 +411,8 @@ fn test_chmod_symlink_non_existing_file_recursive() {
|
|||
);
|
||||
|
||||
// '-v': this should succeed without stderr
|
||||
scene.ucmd()
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("-R")
|
||||
.arg("-v")
|
||||
.arg("755")
|
||||
|
@ -418,7 +422,8 @@ fn test_chmod_symlink_non_existing_file_recursive() {
|
|||
.no_stderr();
|
||||
|
||||
// '-vf': this should be the same than with just '-v'
|
||||
scene.ucmd()
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("-R")
|
||||
.arg("-v")
|
||||
.arg("-f")
|
||||
|
|
|
@ -7,9 +7,7 @@ const SUB_LINK: &str = "subdir/links/sublink.txt";
|
|||
|
||||
#[test]
|
||||
fn test_du_basics() {
|
||||
new_ucmd!()
|
||||
.succeeds()
|
||||
.no_stderr();
|
||||
new_ucmd!().succeeds().no_stderr();
|
||||
}
|
||||
#[cfg(target_vendor = "apple")]
|
||||
fn _du_basics(s: String) {
|
||||
|
@ -178,7 +176,14 @@ fn test_du_h_flag_empty_file() {
|
|||
fn test_du_time() {
|
||||
let ts = TestScenario::new("du");
|
||||
|
||||
let touch = ts.ccmd("touch").arg("-a").arg("-m").arg("-t").arg("201505150000").arg("date_test").run();
|
||||
let touch = ts
|
||||
.ccmd("touch")
|
||||
.arg("-a")
|
||||
.arg("-m")
|
||||
.arg("-t")
|
||||
.arg("201505150000")
|
||||
.arg("date_test")
|
||||
.run();
|
||||
assert!(touch.success);
|
||||
|
||||
let result = ts.ucmd().arg("--time").arg("date_test").run();
|
||||
|
|
|
@ -2,10 +2,7 @@ use crate::common::util::*;
|
|||
|
||||
#[test]
|
||||
fn test_default() {
|
||||
new_ucmd!()
|
||||
.arg("hi")
|
||||
.succeeds()
|
||||
.stdout_only("hi\n");
|
||||
new_ucmd!().arg("hi").succeeds().stdout_only("hi\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -26,17 +26,18 @@ fn test_env_version() {
|
|||
|
||||
#[test]
|
||||
fn test_echo() {
|
||||
let result = new_ucmd!()
|
||||
.arg("echo")
|
||||
.arg("FOO-bar")
|
||||
.succeeds();
|
||||
let result = new_ucmd!().arg("echo").arg("FOO-bar").succeeds();
|
||||
|
||||
assert_eq!(result.stdout_str().trim(), "FOO-bar");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_file_option() {
|
||||
let out = new_ucmd!().arg("-f").arg("vars.conf.txt").run().stdout_move_str();
|
||||
let out = new_ucmd!()
|
||||
.arg("-f")
|
||||
.arg("vars.conf.txt")
|
||||
.run()
|
||||
.stdout_move_str();
|
||||
|
||||
assert_eq!(
|
||||
out.lines()
|
||||
|
@ -89,7 +90,8 @@ fn test_multiple_name_value_pairs() {
|
|||
let out = new_ucmd!().arg("FOO=bar").arg("ABC=xyz").run();
|
||||
|
||||
assert_eq!(
|
||||
out.stdout_str().lines()
|
||||
out.stdout_str()
|
||||
.lines()
|
||||
.filter(|&line| line == "FOO=bar" || line == "ABC=xyz")
|
||||
.count(),
|
||||
2
|
||||
|
|
|
@ -25,6 +25,8 @@ fn test_hostname_full() {
|
|||
let ls_short_res = new_ucmd!().arg("-s").succeeds();
|
||||
assert!(!ls_short_res.stdout_str().trim().is_empty());
|
||||
|
||||
new_ucmd!().arg("-f").succeeds()
|
||||
new_ucmd!()
|
||||
.arg("-f")
|
||||
.succeeds()
|
||||
.stdout_contains(ls_short_res.stdout_str().trim());
|
||||
}
|
||||
|
|
|
@ -46,7 +46,8 @@ fn test_id_from_name() {
|
|||
let result = new_ucmd!().arg(&username).succeeds();
|
||||
let uid = result.stdout_str().trim();
|
||||
|
||||
new_ucmd!().succeeds()
|
||||
new_ucmd!()
|
||||
.succeeds()
|
||||
// Verify that the id found by --user/-u exists in the list
|
||||
.stdout_contains(uid)
|
||||
// Verify that the username found by whoami exists in the list
|
||||
|
@ -65,10 +66,7 @@ fn test_id_name_from_id() {
|
|||
return;
|
||||
}
|
||||
|
||||
let username_id = result
|
||||
.success()
|
||||
.stdout_str()
|
||||
.trim();
|
||||
let username_id = result.success().stdout_str().trim();
|
||||
|
||||
let scene = TestScenario::new("whoami");
|
||||
let result = scene.cmd("whoami").succeeds();
|
||||
|
|
|
@ -16,10 +16,10 @@ fn test_months_whitespace() {
|
|||
#[test]
|
||||
fn test_version_empty_lines() {
|
||||
new_ucmd!()
|
||||
.arg("-V")
|
||||
.arg("version-empty-lines.txt")
|
||||
.succeeds()
|
||||
.stdout_is("\n\n\n\n\n\n\n1.2.3-alpha\n1.2.3-alpha2\n\t\t\t1.12.4\n11.2.3\n");
|
||||
.arg("-V")
|
||||
.arg("version-empty-lines.txt")
|
||||
.succeeds()
|
||||
.stdout_is("\n\n\n\n\n\n\n1.2.3-alpha\n1.2.3-alpha2\n\t\t\t1.12.4\n11.2.3\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue