mirror of
https://github.com/uutils/coreutils
synced 2024-12-14 07:12:44 +00:00
1c230fd779
Summary of changes in UCommand: * Extend UCommand by builder methods and simplify methods in TestScenario * Simplify code structures where possible. Add documentation. * Store bin_path as PathBuf and util_name as String in all structs * Remove UCommand::util and make bin_path, temp_dir private * Rename UCommand::with_limit -> UCommand::limit Summary of changes in TestScenario: * Rename some parameters in TestScenario methods to be more descriptive * Remove ucmd_keepenv, cmd_keepenv from TestScenario. Use UCommand::keep_env instead.
32 lines
779 B
Rust
32 lines
779 B
Rust
use crate::common::util::*;
|
|
|
|
#[test]
|
|
fn test_invalid_arg() {
|
|
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
|
}
|
|
|
|
#[test]
|
|
fn test_users_no_arg() {
|
|
new_ucmd!().succeeds();
|
|
}
|
|
|
|
#[test]
|
|
#[cfg(any(target_vendor = "apple", target_os = "linux"))]
|
|
#[ignore = "issue #3219"]
|
|
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!());
|
|
|
|
// note: clippy::needless_borrow *false positive*
|
|
#[allow(clippy::needless_borrow)]
|
|
let expected = TestScenario::new(&util_name)
|
|
.cmd(util_name)
|
|
.keep_env()
|
|
.env("LC_ALL", "C")
|
|
.succeeds()
|
|
.stdout_move_str();
|
|
|
|
new_ucmd!().succeeds().stdout_is(&expected);
|
|
}
|