2023-08-21 08:49:27 +00:00
|
|
|
// This file is part of the uutils coreutils package.
|
|
|
|
//
|
|
|
|
// For the full copyright and license information, please view the LICENSE
|
|
|
|
// file that was distributed with this source code.
|
2023-03-20 13:51:19 +00:00
|
|
|
use crate::common::util::TestScenario;
|
2020-05-03 20:38:46 +00:00
|
|
|
|
2022-09-10 16:38:14 +00:00
|
|
|
#[test]
|
|
|
|
fn test_invalid_arg() {
|
|
|
|
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
|
|
|
}
|
|
|
|
|
2020-05-03 20:38:46 +00:00
|
|
|
#[test]
|
2021-05-30 05:10:54 +00:00
|
|
|
fn test_users_no_arg() {
|
2021-04-17 23:28:06 +00:00
|
|
|
new_ucmd!().succeeds();
|
2020-05-03 20:38:46 +00:00
|
|
|
}
|
2021-05-28 23:51:00 +00:00
|
|
|
|
2020-05-03 20:38:46 +00:00
|
|
|
#[test]
|
2021-05-28 23:51:00 +00:00
|
|
|
#[cfg(any(target_vendor = "apple", target_os = "linux"))]
|
2022-03-06 22:46:52 +00:00
|
|
|
#[ignore = "issue #3219"]
|
2020-05-03 20:38:46 +00:00
|
|
|
fn test_users_check_name() {
|
2021-05-28 23:51:00 +00:00
|
|
|
#[cfg(target_os = "linux")]
|
|
|
|
let util_name = util_name!();
|
|
|
|
#[cfg(target_vendor = "apple")]
|
2023-11-16 15:02:38 +00:00
|
|
|
let util_name = &format!("g{}", util_name!());
|
2020-05-03 20:38:46 +00:00
|
|
|
|
2023-11-16 15:02:38 +00:00
|
|
|
let expected = TestScenario::new(util_name)
|
2023-01-25 02:40:39 +00:00
|
|
|
.cmd(util_name)
|
2021-06-21 22:22:30 +00:00
|
|
|
.env("LC_ALL", "C")
|
2021-05-28 23:51:00 +00:00
|
|
|
.succeeds()
|
|
|
|
.stdout_move_str();
|
2020-05-03 20:38:46 +00:00
|
|
|
|
2021-05-28 23:51:00 +00:00
|
|
|
new_ucmd!().succeeds().stdout_is(&expected);
|
2020-05-03 20:38:46 +00:00
|
|
|
}
|
2024-05-16 14:24:22 +00:00
|
|
|
|
|
|
|
#[test]
|
|
|
|
#[cfg(target_os = "openbsd")]
|
|
|
|
fn test_users_check_name_openbsd() {
|
|
|
|
new_ucmd!()
|
|
|
|
.args(&["openbsd_utmp"])
|
|
|
|
.run()
|
|
|
|
.stdout_contains("test");
|
|
|
|
}
|