From 49154669a620df00c267fd0c520af6001bf73f79 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Tue, 9 Jan 2024 15:17:15 +0100 Subject: [PATCH 1/2] pathchk: simplify and rename test --- tests/by-util/test_pathchk.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/by-util/test_pathchk.rs b/tests/by-util/test_pathchk.rs index d66ecb9efb..f5d84b5762 100644 --- a/tests/by-util/test_pathchk.rs +++ b/tests/by-util/test_pathchk.rs @@ -4,6 +4,14 @@ // file that was distributed with this source code. use crate::common::util::TestScenario; +#[test] +fn test_no_args() { + new_ucmd!() + .fails() + .no_stdout() + .stderr_contains("pathchk: missing operand"); +} + #[test] fn test_invalid_arg() { new_ucmd!().arg("--definitely-invalid").fails().code_is(1); @@ -164,10 +172,3 @@ fn test_posix_all() { // fail on empty path 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(); -} From f400a07dc6e6fed71efb38a5b84d0d981e355cd9 Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Tue, 9 Jan 2024 15:19:22 +0100 Subject: [PATCH 2/2] pathchk: remove useless comments --- tests/by-util/test_pathchk.rs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tests/by-util/test_pathchk.rs b/tests/by-util/test_pathchk.rs index f5d84b5762..d09c8a2e1e 100644 --- a/tests/by-util/test_pathchk.rs +++ b/tests/by-util/test_pathchk.rs @@ -19,8 +19,6 @@ fn test_invalid_arg() { #[test] fn test_default_mode() { - // test the default mode - // accept some reasonable default new_ucmd!().args(&["dir/file"]).succeeds().no_stdout(); @@ -56,8 +54,6 @@ fn test_default_mode() { #[test] fn test_posix_mode() { - // test the posix mode - // accept some reasonable default new_ucmd!().args(&["-p", "dir/file"]).succeeds().no_stdout(); @@ -82,8 +78,6 @@ fn test_posix_mode() { #[test] fn test_posix_special() { - // test the posix special mode - // accept some reasonable default new_ucmd!().args(&["-P", "dir/file"]).succeeds().no_stdout(); @@ -123,8 +117,6 @@ fn test_posix_special() { #[test] fn test_posix_all() { - // test the posix special mode - // accept some reasonable default new_ucmd!() .args(&["-p", "-P", "dir/file"])