Using the expected result command from the utils library to match other tests

This commit is contained in:
Christopher Dryden 2025-11-22 20:16:02 +00:00 committed by Chris Dryden
parent d678855472
commit 9c82b2c6e4

View file

@ -4,7 +4,7 @@
// file that was distributed with this source code.
use uutests::new_ucmd;
#[cfg(any(target_vendor = "apple", target_os = "linux"))]
use uutests::{util::TestScenario, util_name};
use uutests::{unwrap_or_return, util::TestScenario, util::expected_result, util_name};
#[test]
fn test_invalid_arg() {
@ -19,18 +19,9 @@ fn test_users_no_arg() {
#[test]
#[cfg(any(target_vendor = "apple", target_os = "linux"))]
fn test_users_check_name() {
#[cfg(target_os = "linux")]
let util_name = util_name!();
#[cfg(target_vendor = "apple")]
let util_name = &format!("g{}", util_name!());
let expected = TestScenario::new(util_name)
.cmd(util_name)
.env("LC_ALL", "C")
.succeeds()
.stdout_move_str();
new_ucmd!().succeeds().stdout_is(&expected);
let ts = TestScenario::new(util_name!());
let expected_stdout = unwrap_or_return!(expected_result(&ts, &[])).stdout_move_str();
ts.ucmd().succeeds().stdout_is(expected_stdout);
}
#[test]