1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-15 03:26:18 +00:00

Merge pull request #5962 from wolimst/cut/fix/multiple-mode-args

cut: show error for multiple mode args (`-b`, `-c`, `-f`)
This commit is contained in:
Daniel Hofstetter 2024-02-14 14:23:47 +01:00 committed by GitHub
commit 6adaf31d49
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 48 additions and 7 deletions

View file

@ -270,3 +270,21 @@ fn test_multiple() {
assert_eq!(result.stdout_str(), "b\n");
assert_eq!(result.stderr_str(), "");
}
#[test]
fn test_multiple_mode_args() {
for args in [
vec!["-b1", "-b2"],
vec!["-c1", "-c2"],
vec!["-f1", "-f2"],
vec!["-b1", "-c2"],
vec!["-b1", "-f2"],
vec!["-c1", "-f2"],
vec!["-b1", "-c2", "-f3"],
] {
new_ucmd!()
.args(&args)
.fails()
.stderr_is("cut: invalid usage: expects no more than one of --fields (-f), --chars (-c) or --bytes (-b)\n");
}
}