mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +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
|
@ -2,26 +2,25 @@ use crate::common::util::*;
|
|||
|
||||
#[test]
|
||||
fn test_groups() {
|
||||
let (_, mut ucmd) = at_and_ucmd!();
|
||||
let result = ucmd.run();
|
||||
println!("result.stdout {}", result.stdout);
|
||||
println!("result.stderr = {}", result.stderr);
|
||||
if is_ci() && result.stdout.trim().is_empty() {
|
||||
let result = new_ucmd!().run();
|
||||
println!("result.stdout = {}", result.stdout_str());
|
||||
println!("result.stderr = {}", result.stderr_str());
|
||||
if is_ci() && result.stdout_str().trim().is_empty() {
|
||||
// In the CI, some server are failing to return the group.
|
||||
// As seems to be a configuration issue, ignoring it
|
||||
return;
|
||||
}
|
||||
assert!(result.success);
|
||||
assert!(!result.stdout.trim().is_empty());
|
||||
assert!(!result.stdout_str().trim().is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_groups_arg() {
|
||||
// get the username with the "id -un" command
|
||||
let result = TestScenario::new("id").ucmd_keepenv().arg("-un").run();
|
||||
println!("result.stdout {}", result.stdout);
|
||||
println!("result.stderr = {}", result.stderr);
|
||||
let s1 = String::from(result.stdout.trim());
|
||||
println!("result.stdout = {}", result.stdout_str());
|
||||
println!("result.stderr = {}", result.stderr_str());
|
||||
let s1 = String::from(result.stdout_str().trim());
|
||||
if is_ci() && s1.parse::<f64>().is_ok() {
|
||||
// In the CI, some server are failing to return id -un.
|
||||
// So, if we are getting a uid, just skip this test
|
||||
|
@ -29,18 +28,18 @@ fn test_groups_arg() {
|
|||
return;
|
||||
}
|
||||
|
||||
println!("result.stdout {}", result.stdout);
|
||||
println!("result.stderr = {}", result.stderr);
|
||||
println!("result.stdout = {}", result.stdout_str());
|
||||
println!("result.stderr = {}", result.stderr_str());
|
||||
assert!(result.success);
|
||||
assert!(!result.stdout.is_empty());
|
||||
let username = result.stdout.trim();
|
||||
assert!(!result.stdout_str().is_empty());
|
||||
let username = result.stdout_str().trim();
|
||||
|
||||
// call groups with the user name to check that we
|
||||
// are getting something
|
||||
let (_, mut ucmd) = at_and_ucmd!();
|
||||
let result = ucmd.arg(username).run();
|
||||
println!("result.stdout {}", result.stdout);
|
||||
println!("result.stderr = {}", result.stderr);
|
||||
println!("result.stdout = {}", result.stdout_str());
|
||||
println!("result.stderr = {}", result.stderr_str());
|
||||
assert!(result.success);
|
||||
assert!(!result.stdout.is_empty());
|
||||
assert!(!result.stdout_str().is_empty());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue