Skip to content

Commit 84c1fcd

Browse files
committed
Using the expected result command from the utils library to match other tests
1 parent 2ae83ca commit 84c1fcd

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

tests/by-util/test_users.rs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// file that was distributed with this source code.
55
use uutests::new_ucmd;
66
#[cfg(any(target_vendor = "apple", target_os = "linux"))]
7-
use uutests::{util::TestScenario, util_name};
7+
use uutests::{unwrap_or_return, util::TestScenario, util::expected_result, util_name};
88

99
#[test]
1010
fn test_invalid_arg() {
@@ -19,18 +19,9 @@ fn test_users_no_arg() {
1919
#[test]
2020
#[cfg(any(target_vendor = "apple", target_os = "linux"))]
2121
fn test_users_check_name() {
22-
#[cfg(target_os = "linux")]
23-
let util_name = util_name!();
24-
#[cfg(target_vendor = "apple")]
25-
let util_name = &format!("g{}", util_name!());
26-
27-
let expected = TestScenario::new(util_name)
28-
.cmd(util_name)
29-
.env("LC_ALL", "C")
30-
.succeeds()
31-
.stdout_move_str();
32-
33-
new_ucmd!().succeeds().stdout_is(&expected);
22+
let ts = TestScenario::new(util_name!());
23+
let expected_stdout = unwrap_or_return!(expected_result(&ts, &[])).stdout_move_str();
24+
ts.ucmd().succeeds().stdout_is(expected_stdout);
3425
}
3526

3627
#[test]

0 commit comments

Comments
 (0)