Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pathchk: simplify and rename test #5818

Merged
merged 2 commits into from
Jan 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 8 additions & 15 deletions tests/by-util/test_pathchk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,21 @@
// 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);
}

#[test]
fn test_default_mode() {
// test the default mode

// accept some reasonable default
new_ucmd!().args(&["dir/file"]).succeeds().no_stdout();

Expand Down Expand Up @@ -48,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();

Expand All @@ -74,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();

Expand Down Expand Up @@ -115,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"])
Expand Down Expand Up @@ -164,10 +164,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();
}
Loading