1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

tests ~ fix cargo clippy complaint (clippy::needless_borrow)

This commit is contained in:
Roy Ivy III 2021-06-06 14:13:54 -05:00
parent 8f0d42da39
commit 0dc8c18bac
4 changed files with 21 additions and 21 deletions

View file

@ -438,7 +438,7 @@ fn test_domain_socket() {
let child = new_ucmd!().args(&[socket_path]).run_no_wait(); let child = new_ucmd!().args(&[socket_path]).run_no_wait();
barrier.wait(); barrier.wait();
let stdout = &child.wait_with_output().unwrap().stdout; let stdout = &child.wait_with_output().unwrap().stdout;
let output = String::from_utf8_lossy(&stdout); let output = String::from_utf8_lossy(stdout);
assert_eq!("a\tb", output); assert_eq!("a\tb", output);
thread.join().unwrap(); thread.join().unwrap();

View file

@ -618,7 +618,7 @@ fn test_cp_deref() {
// Check the content of the destination file that was copied. // Check the content of the destination file that was copied.
assert_eq!(at.read(TEST_COPY_TO_FOLDER_FILE), "Hello, World!\n"); assert_eq!(at.read(TEST_COPY_TO_FOLDER_FILE), "Hello, World!\n");
let path_to_check = path_to_new_symlink.to_str().unwrap(); let path_to_check = path_to_new_symlink.to_str().unwrap();
assert_eq!(at.read(&path_to_check), "Hello, World!\n"); assert_eq!(at.read(path_to_check), "Hello, World!\n");
} }
#[test] #[test]
fn test_cp_no_deref() { fn test_cp_no_deref() {
@ -655,7 +655,7 @@ fn test_cp_no_deref() {
// Check the content of the destination file that was copied. // Check the content of the destination file that was copied.
assert_eq!(at.read(TEST_COPY_TO_FOLDER_FILE), "Hello, World!\n"); assert_eq!(at.read(TEST_COPY_TO_FOLDER_FILE), "Hello, World!\n");
let path_to_check = path_to_new_symlink.to_str().unwrap(); let path_to_check = path_to_new_symlink.to_str().unwrap();
assert_eq!(at.read(&path_to_check), "Hello, World!\n"); assert_eq!(at.read(path_to_check), "Hello, World!\n");
} }
#[test] #[test]
@ -823,7 +823,7 @@ fn test_cp_deref_folder_to_folder() {
// Check the content of the symlink // Check the content of the symlink
let path_to_check = path_to_new_symlink.to_str().unwrap(); let path_to_check = path_to_new_symlink.to_str().unwrap();
assert_eq!(at.read(&path_to_check), "Hello, World!\n"); assert_eq!(at.read(path_to_check), "Hello, World!\n");
} }
#[test] #[test]
@ -923,7 +923,7 @@ fn test_cp_no_deref_folder_to_folder() {
// Check the content of the symlink // Check the content of the symlink
let path_to_check = path_to_new_symlink.to_str().unwrap(); let path_to_check = path_to_new_symlink.to_str().unwrap();
assert_eq!(at.read(&path_to_check), "Hello, World!\n"); assert_eq!(at.read(path_to_check), "Hello, World!\n");
} }
#[test] #[test]

View file

@ -398,7 +398,7 @@ fn test_ls_long_formats() {
.arg("--author") .arg("--author")
.arg("test-long-formats") .arg("test-long-formats")
.succeeds(); .succeeds();
assert!(re_three.is_match(&result.stdout_str())); assert!(re_three.is_match(result.stdout_str()));
#[cfg(unix)] #[cfg(unix)]
{ {
@ -701,20 +701,20 @@ fn test_ls_styles() {
.arg("-l") .arg("-l")
.arg("--time-style=full-iso") .arg("--time-style=full-iso")
.succeeds(); .succeeds();
assert!(re_full.is_match(&result.stdout_str())); assert!(re_full.is_match(result.stdout_str()));
//long-iso //long-iso
let result = scene let result = scene
.ucmd() .ucmd()
.arg("-l") .arg("-l")
.arg("--time-style=long-iso") .arg("--time-style=long-iso")
.succeeds(); .succeeds();
assert!(re_long.is_match(&result.stdout_str())); assert!(re_long.is_match(result.stdout_str()));
//iso //iso
let result = scene.ucmd().arg("-l").arg("--time-style=iso").succeeds(); let result = scene.ucmd().arg("-l").arg("--time-style=iso").succeeds();
assert!(re_iso.is_match(&result.stdout_str())); assert!(re_iso.is_match(result.stdout_str()));
//locale //locale
let result = scene.ucmd().arg("-l").arg("--time-style=locale").succeeds(); let result = scene.ucmd().arg("-l").arg("--time-style=locale").succeeds();
assert!(re_locale.is_match(&result.stdout_str())); assert!(re_locale.is_match(result.stdout_str()));
//Overwrite options tests //Overwrite options tests
let result = scene let result = scene
@ -723,19 +723,19 @@ fn test_ls_styles() {
.arg("--time-style=long-iso") .arg("--time-style=long-iso")
.arg("--time-style=iso") .arg("--time-style=iso")
.succeeds(); .succeeds();
assert!(re_iso.is_match(&result.stdout_str())); assert!(re_iso.is_match(result.stdout_str()));
let result = scene let result = scene
.ucmd() .ucmd()
.arg("--time-style=iso") .arg("--time-style=iso")
.arg("--full-time") .arg("--full-time")
.succeeds(); .succeeds();
assert!(re_full.is_match(&result.stdout_str())); assert!(re_full.is_match(result.stdout_str()));
let result = scene let result = scene
.ucmd() .ucmd()
.arg("--full-time") .arg("--full-time")
.arg("--time-style=iso") .arg("--time-style=iso")
.succeeds(); .succeeds();
assert!(re_iso.is_match(&result.stdout_str())); assert!(re_iso.is_match(result.stdout_str()));
let result = scene let result = scene
.ucmd() .ucmd()
@ -743,7 +743,7 @@ fn test_ls_styles() {
.arg("--time-style=iso") .arg("--time-style=iso")
.arg("--full-time") .arg("--full-time")
.succeeds(); .succeeds();
assert!(re_full.is_match(&result.stdout_str())); assert!(re_full.is_match(result.stdout_str()));
let result = scene let result = scene
.ucmd() .ucmd()
@ -751,7 +751,7 @@ fn test_ls_styles() {
.arg("-x") .arg("-x")
.arg("-l") .arg("-l")
.succeeds(); .succeeds();
assert!(re_full.is_match(&result.stdout_str())); assert!(re_full.is_match(result.stdout_str()));
at.touch("test2"); at.touch("test2");
let result = scene.ucmd().arg("--full-time").arg("-x").succeeds(); let result = scene.ucmd().arg("--full-time").arg("-x").succeeds();

View file

@ -38,7 +38,7 @@ fn test_posix_mode() {
// fail on long path // fail on long path
new_ucmd!() new_ucmd!()
.args(&["-p", &"dir".repeat(libc::PATH_MAX as usize + 1).as_str()]) .args(&["-p", "dir".repeat(libc::PATH_MAX as usize + 1).as_str()])
.fails() .fails()
.no_stdout(); .no_stdout();
@ -46,7 +46,7 @@ fn test_posix_mode() {
new_ucmd!() new_ucmd!()
.args(&[ .args(&[
"-p", "-p",
&format!("dir/{}", "file".repeat(libc::FILENAME_MAX as usize + 1)).as_str(), format!("dir/{}", "file".repeat(libc::FILENAME_MAX as usize + 1)).as_str(),
]) ])
.fails() .fails()
.no_stdout(); .no_stdout();
@ -76,7 +76,7 @@ fn test_posix_special() {
// fail on long path // fail on long path
new_ucmd!() new_ucmd!()
.args(&["-P", &"dir".repeat(libc::PATH_MAX as usize + 1).as_str()]) .args(&["-P", "dir".repeat(libc::PATH_MAX as usize + 1).as_str()])
.fails() .fails()
.no_stdout(); .no_stdout();
@ -84,7 +84,7 @@ fn test_posix_special() {
new_ucmd!() new_ucmd!()
.args(&[ .args(&[
"-P", "-P",
&format!("dir/{}", "file".repeat(libc::FILENAME_MAX as usize + 1)).as_str(), format!("dir/{}", "file".repeat(libc::FILENAME_MAX as usize + 1)).as_str(),
]) ])
.fails() .fails()
.no_stdout(); .no_stdout();
@ -117,7 +117,7 @@ fn test_posix_all() {
.args(&[ .args(&[
"-p", "-p",
"-P", "-P",
&"dir".repeat(libc::PATH_MAX as usize + 1).as_str(), "dir".repeat(libc::PATH_MAX as usize + 1).as_str(),
]) ])
.fails() .fails()
.no_stdout(); .no_stdout();
@ -127,7 +127,7 @@ fn test_posix_all() {
.args(&[ .args(&[
"-p", "-p",
"-P", "-P",
&format!("dir/{}", "file".repeat(libc::FILENAME_MAX as usize + 1)).as_str(), format!("dir/{}", "file".repeat(libc::FILENAME_MAX as usize + 1)).as_str(),
]) ])
.fails() .fails()
.no_stdout(); .no_stdout();