1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 12:07:46 +00:00

Merge pull request #5818 from cakebaker/pathchk_no_args

pathchk: simplify and rename test
This commit is contained in:
Sylvestre Ledru 2024-01-14 23:28:42 +01:00 committed by GitHub
commit ae279c9961
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,6 +4,14 @@
// file that was distributed with this source code. // file that was distributed with this source code.
use crate::common::util::TestScenario; use crate::common::util::TestScenario;
#[test]
fn test_no_args() {
new_ucmd!()
.fails()
.no_stdout()
.stderr_contains("pathchk: missing operand");
}
#[test] #[test]
fn test_invalid_arg() { fn test_invalid_arg() {
new_ucmd!().arg("--definitely-invalid").fails().code_is(1); new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
@ -11,8 +19,6 @@ fn test_invalid_arg() {
#[test] #[test]
fn test_default_mode() { fn test_default_mode() {
// test the default mode
// accept some reasonable default // accept some reasonable default
new_ucmd!().args(&["dir/file"]).succeeds().no_stdout(); new_ucmd!().args(&["dir/file"]).succeeds().no_stdout();
@ -48,8 +54,6 @@ fn test_default_mode() {
#[test] #[test]
fn test_posix_mode() { fn test_posix_mode() {
// test the posix mode
// accept some reasonable default // accept some reasonable default
new_ucmd!().args(&["-p", "dir/file"]).succeeds().no_stdout(); new_ucmd!().args(&["-p", "dir/file"]).succeeds().no_stdout();
@ -74,8 +78,6 @@ fn test_posix_mode() {
#[test] #[test]
fn test_posix_special() { fn test_posix_special() {
// test the posix special mode
// accept some reasonable default // accept some reasonable default
new_ucmd!().args(&["-P", "dir/file"]).succeeds().no_stdout(); new_ucmd!().args(&["-P", "dir/file"]).succeeds().no_stdout();
@ -115,8 +117,6 @@ fn test_posix_special() {
#[test] #[test]
fn test_posix_all() { fn test_posix_all() {
// test the posix special mode
// accept some reasonable default // accept some reasonable default
new_ucmd!() new_ucmd!()
.args(&["-p", "-P", "dir/file"]) .args(&["-p", "-P", "dir/file"])
@ -164,10 +164,3 @@ fn test_posix_all() {
// fail on empty path // fail on empty path
new_ucmd!().args(&["-p", "-P", ""]).fails().no_stdout(); new_ucmd!().args(&["-p", "-P", ""]).fails().no_stdout();
} }
#[test]
fn test_args_parsing() {
// fail on no args
let empty_args: [String; 0] = [];
new_ucmd!().args(&empty_args).fails().no_stdout();
}