mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-09-15 03:26:18 +00:00
Merge pull request #6112 from BenWiederhake/dev-comm-all-args
comm: Handle duplicated flags and output-delimiter correctly
This commit is contained in:
commit
6f07bf10a1
4 changed files with 104 additions and 8 deletions
|
@ -75,6 +75,14 @@ fn total_with_suppressed_regular_output() {
|
|||
.stdout_is_fixture("ab_total_suppressed_regular_output.expected");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn repeated_flags() {
|
||||
new_ucmd!()
|
||||
.args(&["--total", "-123123", "--total", "a", "b"])
|
||||
.succeeds()
|
||||
.stdout_is_fixture("ab_total_suppressed_regular_output.expected");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn total_with_output_delimiter() {
|
||||
new_ucmd!()
|
||||
|
@ -91,6 +99,69 @@ fn output_delimiter() {
|
|||
.stdout_only_fixture("ab_delimiter_word.expected");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn output_delimiter_hyphen_one() {
|
||||
new_ucmd!()
|
||||
.args(&["--output-delimiter", "-1", "a", "b"])
|
||||
.succeeds()
|
||||
.stdout_only_fixture("ab_delimiter_hyphen_one.expected");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn output_delimiter_hyphen_help() {
|
||||
new_ucmd!()
|
||||
.args(&["--output-delimiter", "--help", "a", "b"])
|
||||
.succeeds()
|
||||
.stdout_only_fixture("ab_delimiter_hyphen_help.expected");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn output_delimiter_multiple_identical() {
|
||||
new_ucmd!()
|
||||
.args(&[
|
||||
"--output-delimiter=word",
|
||||
"--output-delimiter=word",
|
||||
"a",
|
||||
"b",
|
||||
])
|
||||
.succeeds()
|
||||
.stdout_only_fixture("ab_delimiter_word.expected");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn output_delimiter_multiple_different() {
|
||||
new_ucmd!()
|
||||
.args(&[
|
||||
"--output-delimiter=word",
|
||||
"--output-delimiter=other",
|
||||
"a",
|
||||
"b",
|
||||
])
|
||||
.fails()
|
||||
.no_stdout()
|
||||
.stderr_contains("multiple")
|
||||
.stderr_contains("output")
|
||||
.stderr_contains("delimiters");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "This is too weird; deviate intentionally."]
|
||||
fn output_delimiter_multiple_different_prevents_help() {
|
||||
new_ucmd!()
|
||||
.args(&[
|
||||
"--output-delimiter=word",
|
||||
"--output-delimiter=other",
|
||||
"--help",
|
||||
"a",
|
||||
"b",
|
||||
])
|
||||
.fails()
|
||||
.no_stdout()
|
||||
.stderr_contains("multiple")
|
||||
.stderr_contains("output")
|
||||
.stderr_contains("delimiters");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn output_delimiter_nul() {
|
||||
new_ucmd!()
|
||||
|
|
3
tests/fixtures/comm/ab_delimiter_hyphen_help.expected
vendored
Normal file
3
tests/fixtures/comm/ab_delimiter_hyphen_help.expected
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
a
|
||||
--helpb
|
||||
--help--helpz
|
3
tests/fixtures/comm/ab_delimiter_hyphen_one.expected
vendored
Normal file
3
tests/fixtures/comm/ab_delimiter_hyphen_one.expected
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
a
|
||||
-1b
|
||||
-1-1z
|
Loading…
Add table
Add a link
Reference in a new issue