mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
sort: disallow certain flags with -d and -i
GNU sort disallows these combinations, presumably because they are likely not what the user really wants. Ignoring characters would cause things to be put together that aren't together in the input. For example, -dn would cause "0.12" or "0,12" to be parsed as "12" which is highly unexpected and confusing.
This commit is contained in:
parent
fb2ae04b8f
commit
4a305b32c6
2 changed files with 56 additions and 5 deletions
|
@ -581,3 +581,30 @@ fn test_check_silent() {
|
|||
.fails()
|
||||
.stdout_is("");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_dictionary_and_nonprinting_conflicts() {
|
||||
let conflicting_args = ["n", "h", "g", "M"];
|
||||
for restricted_arg in &["d", "i"] {
|
||||
for conflicting_arg in &conflicting_args {
|
||||
new_ucmd!()
|
||||
.arg(&format!("-{}{}", restricted_arg, conflicting_arg))
|
||||
.fails();
|
||||
}
|
||||
for conflicting_arg in &conflicting_args {
|
||||
new_ucmd!()
|
||||
.args(&[
|
||||
format!("-{}", restricted_arg).as_str(),
|
||||
"-k",
|
||||
&format!("1,1{}", conflicting_arg),
|
||||
])
|
||||
.succeeds();
|
||||
}
|
||||
for conflicting_arg in &conflicting_args {
|
||||
// FIXME: this should ideally fail.
|
||||
new_ucmd!()
|
||||
.args(&["-k", &format!("1{},1{}", restricted_arg, conflicting_arg)])
|
||||
.succeeds();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue