Files

60 lines
1.4 KiB
Rust
Raw Permalink Normal View History

2023-08-21 10:49:27 +02: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.
2025-03-28 09:51:51 +01:00
use uutests::new_ucmd;
#[cfg(any(target_vendor = "apple", target_os = "linux"))]
use uutests::{util::TestScenario, util_name};
2020-05-03 22:38:46 +02:00
2026-01-11 00:43:26 +09:00
#[ignore = "does not work as same as users > /dev/full"]
#[test]
#[cfg(target_os = "linux")]
fn test_full_panic() {
let full = std::fs::OpenOptions::new()
.write(true)
.open("/dev/full")
.unwrap();
new_ucmd!()
.set_stdout(full)
.fails()
.stderr_contains("No space");
}
2022-09-10 18:38:14 +02:00
#[test]
fn test_invalid_arg() {
2025-03-01 15:29:11 +01:00
new_ucmd!().arg("--definitely-invalid").fails_with_code(1);
2022-09-10 18:38:14 +02:00
}
2020-05-03 22:38:46 +02:00
#[test]
fn test_users_no_arg() {
2021-04-18 02:28:06 +03:00
new_ucmd!().succeeds();
2020-05-03 22:38:46 +02:00
}
2020-05-03 22:38:46 +02:00
#[test]
#[cfg(any(target_vendor = "apple", target_os = "linux"))]
2022-03-06 17:46:52 -05:00
#[ignore = "issue #3219"]
2020-05-03 22:38:46 +02:00
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!());
2020-05-03 22:38:46 +02:00
let expected = TestScenario::new(util_name)
.cmd(util_name)
.env("LC_ALL", "C")
.succeeds()
.stdout_move_str();
2020-05-03 22:38:46 +02:00
new_ucmd!().succeeds().stdout_is(&expected);
2020-05-03 22:38:46 +02:00
}
2024-05-16 17:54:22 +03:30
#[test]
#[cfg(target_os = "openbsd")]
fn test_users_check_name_openbsd() {
new_ucmd!()
.args(&["openbsd_utmp"])
.succeeds()
2024-05-16 17:54:22 +03:30
.stdout_contains("test");
}