From 1137d9a62d7ef5d05c4b8417ab41b5de814c51fc Mon Sep 17 00:00:00 2001 From: Jadi Date: Thu, 4 Apr 2024 21:33:22 +0330 Subject: [PATCH] cut: two new tests; -d conflict & no arg --- tests/by-util/test_cut.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/by-util/test_cut.rs b/tests/by-util/test_cut.rs index 50d158f96..86d3ddf0f 100644 --- a/tests/by-util/test_cut.rs +++ b/tests/by-util/test_cut.rs @@ -117,6 +117,17 @@ fn test_whitespace_with_char() { .code_is(1); } +#[test] +fn test_delimiter_with_byte_and_char() { + for conflicting_arg in ["-c", "-b"] { + new_ucmd!() + .args(&[conflicting_arg, COMPLEX_SEQUENCE.sequence, "-d="]) + .fails() + .stderr_is("cut: invalid input: The '--delimiter' ('-d') option only usable if printing a sequence of fields\n") + .code_is(1); + } +} + #[test] fn test_too_large() { new_ucmd!() @@ -289,6 +300,13 @@ fn test_multiple_mode_args() { } } +#[test] +fn test_no_argument() { + new_ucmd!().fails().stderr_is( + "cut: invalid usage: expects one of --fields (-f), --chars (-c) or --bytes (-b)\n", + ); +} + #[test] #[cfg(unix)] fn test_8bit_non_utf8_delimiter() {