From 9c82b2c6e47566e2a36c8625035ff345c73871d8 Mon Sep 17 00:00:00 2001 From: Christopher Dryden Date: Sat, 22 Nov 2025 20:16:02 +0000 Subject: [PATCH] Using the expected result command from the utils library to match other tests --- tests/by-util/test_users.rs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/tests/by-util/test_users.rs b/tests/by-util/test_users.rs index 97bb49242..ab586029f 100644 --- a/tests/by-util/test_users.rs +++ b/tests/by-util/test_users.rs @@ -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]