mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 19:47:45 +00:00
Fix some tests to not use CmdResult fields
This commit is contained in:
parent
4695667c7c
commit
81d42aa2b3
22 changed files with 353 additions and 478 deletions
|
@ -195,12 +195,8 @@ fn test_install_mode_numeric() {
|
|||
let mode_arg = "-m 0333";
|
||||
at.mkdir(dir2);
|
||||
|
||||
let result = scene.ucmd().arg(mode_arg).arg(file).arg(dir2).run();
|
||||
scene.ucmd().arg(mode_arg).arg(file).arg(dir2).succeeds();
|
||||
|
||||
println!("stderr = {:?}", result.stderr);
|
||||
println!("stdout = {:?}", result.stdout);
|
||||
|
||||
assert!(result.success);
|
||||
let dest_file = &format!("{}/{}", dir2, file);
|
||||
assert!(at.file_exists(file));
|
||||
assert!(at.file_exists(dest_file));
|
||||
|
@ -313,16 +309,13 @@ fn test_install_target_new_file_with_group() {
|
|||
.arg(format!("{}/{}", dir, file))
|
||||
.run();
|
||||
|
||||
println!("stderr = {:?}", result.stderr);
|
||||
println!("stdout = {:?}", result.stdout);
|
||||
|
||||
if is_ci() && result.stderr.contains("error: no such group:") {
|
||||
if is_ci() && result.stderr_str().contains("error: no such group:") {
|
||||
// In the CI, some server are failing to return the group.
|
||||
// As seems to be a configuration issue, ignoring it
|
||||
return;
|
||||
}
|
||||
|
||||
assert!(result.success);
|
||||
result.success();
|
||||
assert!(at.file_exists(file));
|
||||
assert!(at.file_exists(&format!("{}/{}", dir, file)));
|
||||
}
|
||||
|
@ -343,16 +336,13 @@ fn test_install_target_new_file_with_owner() {
|
|||
.arg(format!("{}/{}", dir, file))
|
||||
.run();
|
||||
|
||||
println!("stderr = {:?}", result.stderr);
|
||||
println!("stdout = {:?}", result.stdout);
|
||||
|
||||
if is_ci() && result.stderr.contains("error: no such user:") {
|
||||
// In the CI, some server are failing to return the user id.
|
||||
// As seems to be a configuration issue, ignoring it
|
||||
return;
|
||||
}
|
||||
|
||||
assert!(result.success);
|
||||
result.success();
|
||||
assert!(at.file_exists(file));
|
||||
assert!(at.file_exists(&format!("{}/{}", dir, file)));
|
||||
}
|
||||
|
@ -366,13 +356,10 @@ fn test_install_target_new_file_failing_nonexistent_parent() {
|
|||
|
||||
at.touch(file1);
|
||||
|
||||
let err = ucmd
|
||||
.arg(file1)
|
||||
ucmd.arg(file1)
|
||||
.arg(format!("{}/{}", dir, file2))
|
||||
.fails()
|
||||
.stderr;
|
||||
|
||||
assert!(err.contains("not a directory"))
|
||||
.stderr_contains(&"not a directory");
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -417,18 +404,12 @@ fn test_install_copy_file() {
|
|||
#[test]
|
||||
#[cfg(target_os = "linux")]
|
||||
fn test_install_target_file_dev_null() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
|
||||
let file1 = "/dev/null";
|
||||
let file2 = "target_file";
|
||||
|
||||
let result = scene.ucmd().arg(file1).arg(file2).run();
|
||||
|
||||
println!("stderr = {:?}", result.stderr);
|
||||
println!("stdout = {:?}", result.stdout);
|
||||
|
||||
assert!(result.success);
|
||||
ucmd.arg(file1).arg(file2).succeeds();
|
||||
|
||||
assert!(at.file_exists(file2));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue