mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
clippy: fix redundant_clone lint warnings in tests
This commit is contained in:
parent
2ee782fcf1
commit
29e5d0b42b
4 changed files with 19 additions and 19 deletions
|
@ -471,7 +471,7 @@ fn test_chown_fail_id() {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_chown_only_user_id_nonexistent_user() {
|
fn test_chown_only_user_id_nonexistent_user() {
|
||||||
let ts = TestScenario::new(util_name!());
|
let ts = TestScenario::new(util_name!());
|
||||||
let at = ts.fixtures.clone();
|
let at = &ts.fixtures;
|
||||||
at.touch("f");
|
at.touch("f");
|
||||||
if let Ok(result) = run_ucmd_as_root(&ts, &["12345", "f"]) {
|
if let Ok(result) = run_ucmd_as_root(&ts, &["12345", "f"]) {
|
||||||
result.success().no_stdout().no_stderr();
|
result.success().no_stdout().no_stderr();
|
||||||
|
@ -537,7 +537,7 @@ fn test_chown_only_group_id() {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_chown_only_group_id_nonexistent_group() {
|
fn test_chown_only_group_id_nonexistent_group() {
|
||||||
let ts = TestScenario::new(util_name!());
|
let ts = TestScenario::new(util_name!());
|
||||||
let at = ts.fixtures.clone();
|
let at = &ts.fixtures;
|
||||||
at.touch("f");
|
at.touch("f");
|
||||||
if let Ok(result) = run_ucmd_as_root(&ts, &[":12345", "f"]) {
|
if let Ok(result) = run_ucmd_as_root(&ts, &[":12345", "f"]) {
|
||||||
result.success().no_stdout().no_stderr();
|
result.success().no_stdout().no_stderr();
|
||||||
|
|
|
@ -165,7 +165,7 @@ fn test_chroot_skip_chdir_not_root() {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_chroot_skip_chdir() {
|
fn test_chroot_skip_chdir() {
|
||||||
let ts = TestScenario::new(util_name!());
|
let ts = TestScenario::new(util_name!());
|
||||||
let at = ts.fixtures.clone();
|
let at = &ts.fixtures;
|
||||||
let dirs = ["/", "/.", "/..", "isroot"];
|
let dirs = ["/", "/.", "/..", "isroot"];
|
||||||
at.symlink_file("/", "isroot");
|
at.symlink_file("/", "isroot");
|
||||||
for dir in dirs {
|
for dir in dirs {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
use crate::common::util::expected_result;
|
use crate::common::util::expected_result;
|
||||||
use crate::common::util::TestScenario;
|
use crate::common::util::TestScenario;
|
||||||
use ::env::native_int_str::{Convert, NCvt};
|
use env::native_int_str::{Convert, NCvt};
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
@ -475,8 +475,8 @@ fn test_gnu_e20() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_split_string_misc() {
|
fn test_split_string_misc() {
|
||||||
use ::env::native_int_str::NCvt;
|
use env::native_int_str::NCvt;
|
||||||
use ::env::parse_args_from_str;
|
use env::parse_args_from_str;
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
NCvt::convert(vec!["A=B", "FOO=AR", "sh", "-c", "echo $A$FOO"]),
|
NCvt::convert(vec!["A=B", "FOO=AR", "sh", "-c", "echo $A$FOO"]),
|
||||||
|
@ -692,13 +692,13 @@ fn test_env_overwrite_arg0() {
|
||||||
fn test_env_arg_argv0_overwrite() {
|
fn test_env_arg_argv0_overwrite() {
|
||||||
let ts = TestScenario::new(util_name!());
|
let ts = TestScenario::new(util_name!());
|
||||||
|
|
||||||
let bin = ts.bin_path.clone();
|
let bin = &ts.bin_path;
|
||||||
|
|
||||||
// overwrite --argv0 by --argv0
|
// overwrite --argv0 by --argv0
|
||||||
ts.ucmd()
|
ts.ucmd()
|
||||||
.args(&["--argv0", "dirname"])
|
.args(&["--argv0", "dirname"])
|
||||||
.args(&["--argv0", "echo"])
|
.args(&["--argv0", "echo"])
|
||||||
.arg(&bin)
|
.arg(bin)
|
||||||
.args(&["aa/bb/cc"])
|
.args(&["aa/bb/cc"])
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_is("aa/bb/cc\n")
|
.stdout_is("aa/bb/cc\n")
|
||||||
|
@ -708,7 +708,7 @@ fn test_env_arg_argv0_overwrite() {
|
||||||
ts.ucmd()
|
ts.ucmd()
|
||||||
.args(&["-a", "dirname"])
|
.args(&["-a", "dirname"])
|
||||||
.args(&["-a", "echo"])
|
.args(&["-a", "echo"])
|
||||||
.arg(&bin)
|
.arg(bin)
|
||||||
.args(&["aa/bb/cc"])
|
.args(&["aa/bb/cc"])
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_is("aa/bb/cc\n")
|
.stdout_is("aa/bb/cc\n")
|
||||||
|
@ -718,7 +718,7 @@ fn test_env_arg_argv0_overwrite() {
|
||||||
ts.ucmd()
|
ts.ucmd()
|
||||||
.args(&["--argv0", "dirname"])
|
.args(&["--argv0", "dirname"])
|
||||||
.args(&["-a", "echo"])
|
.args(&["-a", "echo"])
|
||||||
.arg(&bin)
|
.arg(bin)
|
||||||
.args(&["aa/bb/cc"])
|
.args(&["aa/bb/cc"])
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_is("aa/bb/cc\n")
|
.stdout_is("aa/bb/cc\n")
|
||||||
|
@ -728,7 +728,7 @@ fn test_env_arg_argv0_overwrite() {
|
||||||
ts.ucmd()
|
ts.ucmd()
|
||||||
.args(&["-a", "dirname"])
|
.args(&["-a", "dirname"])
|
||||||
.args(&["--argv0", "echo"])
|
.args(&["--argv0", "echo"])
|
||||||
.arg(&bin)
|
.arg(bin)
|
||||||
.args(&["aa/bb/cc"])
|
.args(&["aa/bb/cc"])
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_is("aa/bb/cc\n")
|
.stdout_is("aa/bb/cc\n")
|
||||||
|
@ -740,13 +740,13 @@ fn test_env_arg_argv0_overwrite() {
|
||||||
fn test_env_arg_argv0_overwrite_mixed_with_string_args() {
|
fn test_env_arg_argv0_overwrite_mixed_with_string_args() {
|
||||||
let ts = TestScenario::new(util_name!());
|
let ts = TestScenario::new(util_name!());
|
||||||
|
|
||||||
let bin = ts.bin_path.clone();
|
let bin = &ts.bin_path;
|
||||||
|
|
||||||
// string arg following normal
|
// string arg following normal
|
||||||
ts.ucmd()
|
ts.ucmd()
|
||||||
.args(&["-S--argv0 dirname"])
|
.args(&["-S--argv0 dirname"])
|
||||||
.args(&["--argv0", "echo"])
|
.args(&["--argv0", "echo"])
|
||||||
.arg(&bin)
|
.arg(bin)
|
||||||
.args(&["aa/bb/cc"])
|
.args(&["aa/bb/cc"])
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_is("aa/bb/cc\n")
|
.stdout_is("aa/bb/cc\n")
|
||||||
|
@ -756,7 +756,7 @@ fn test_env_arg_argv0_overwrite_mixed_with_string_args() {
|
||||||
ts.ucmd()
|
ts.ucmd()
|
||||||
.args(&["-a", "dirname"])
|
.args(&["-a", "dirname"])
|
||||||
.args(&["-S-a echo"])
|
.args(&["-S-a echo"])
|
||||||
.arg(&bin)
|
.arg(bin)
|
||||||
.args(&["aa/bb/cc"])
|
.args(&["aa/bb/cc"])
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_is("aa/bb/cc\n")
|
.stdout_is("aa/bb/cc\n")
|
||||||
|
@ -765,7 +765,7 @@ fn test_env_arg_argv0_overwrite_mixed_with_string_args() {
|
||||||
// one large string arg
|
// one large string arg
|
||||||
ts.ucmd()
|
ts.ucmd()
|
||||||
.args(&["-S--argv0 dirname -a echo"])
|
.args(&["-S--argv0 dirname -a echo"])
|
||||||
.arg(&bin)
|
.arg(bin)
|
||||||
.args(&["aa/bb/cc"])
|
.args(&["aa/bb/cc"])
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_is("aa/bb/cc\n")
|
.stdout_is("aa/bb/cc\n")
|
||||||
|
@ -775,7 +775,7 @@ fn test_env_arg_argv0_overwrite_mixed_with_string_args() {
|
||||||
ts.ucmd()
|
ts.ucmd()
|
||||||
.args(&["-S-a dirname"])
|
.args(&["-S-a dirname"])
|
||||||
.args(&["-S--argv0 echo"])
|
.args(&["-S--argv0 echo"])
|
||||||
.arg(&bin)
|
.arg(bin)
|
||||||
.args(&["aa/bb/cc"])
|
.args(&["aa/bb/cc"])
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_is("aa/bb/cc\n")
|
.stdout_is("aa/bb/cc\n")
|
||||||
|
@ -786,7 +786,7 @@ fn test_env_arg_argv0_overwrite_mixed_with_string_args() {
|
||||||
.args(&["-a", "sleep"])
|
.args(&["-a", "sleep"])
|
||||||
.args(&["-S-a dirname"])
|
.args(&["-S-a dirname"])
|
||||||
.args(&["-a", "echo"])
|
.args(&["-a", "echo"])
|
||||||
.arg(&bin)
|
.arg(bin)
|
||||||
.args(&["aa/bb/cc"])
|
.args(&["aa/bb/cc"])
|
||||||
.succeeds()
|
.succeeds()
|
||||||
.stdout_is("aa/bb/cc\n")
|
.stdout_is("aa/bb/cc\n")
|
||||||
|
@ -916,8 +916,8 @@ mod tests_split_iterator {
|
||||||
|
|
||||||
use std::ffi::OsString;
|
use std::ffi::OsString;
|
||||||
|
|
||||||
use ::env::parse_error::ParseError;
|
|
||||||
use env::native_int_str::{from_native_int_representation_owned, Convert, NCvt};
|
use env::native_int_str::{from_native_int_representation_owned, Convert, NCvt};
|
||||||
|
use env::parse_error::ParseError;
|
||||||
|
|
||||||
fn split(input: &str) -> Result<Vec<OsString>, ParseError> {
|
fn split(input: &str) -> Result<Vec<OsString>, ParseError> {
|
||||||
::env::split_iterator::split(&NCvt::convert(input)).map(|vec| {
|
::env::split_iterator::split(&NCvt::convert(input)).map(|vec| {
|
||||||
|
|
|
@ -1689,7 +1689,7 @@ fn test_target_file_ends_with_slash() {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_install_root_combined() {
|
fn test_install_root_combined() {
|
||||||
let ts = TestScenario::new(util_name!());
|
let ts = TestScenario::new(util_name!());
|
||||||
let at = ts.fixtures.clone();
|
let at = &ts.fixtures;
|
||||||
at.touch("a");
|
at.touch("a");
|
||||||
at.touch("c");
|
at.touch("c");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue