Skip to content

Commit 1fa0b03

Browse files
committed
comm: permit and test separators that contain a hyphen
1 parent dcb53b6 commit 1fa0b03

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

src/uu/comm/src/comm.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ pub fn uu_app() -> Command {
186186
.help("separate columns with STR")
187187
.value_name("STR")
188188
.default_value(options::DELIMITER_DEFAULT)
189+
.allow_hyphen_values(true)
189190
.hide_default_value(true),
190191
)
191192
.arg(

tests/by-util/test_comm.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,22 @@ fn output_delimiter() {
9191
.stdout_only_fixture("ab_delimiter_word.expected");
9292
}
9393

94+
#[test]
95+
fn output_delimiter_hyphen_one() {
96+
new_ucmd!()
97+
.args(&["--output-delimiter", "-1", "a", "b"])
98+
.succeeds()
99+
.stdout_only_fixture("ab_delimiter_hyphen_one.expected");
100+
}
101+
102+
#[test]
103+
fn output_delimiter_hyphen_help() {
104+
new_ucmd!()
105+
.args(&["--output-delimiter", "--help", "a", "b"])
106+
.succeeds()
107+
.stdout_only_fixture("ab_delimiter_hyphen_help.expected");
108+
}
109+
94110
#[test]
95111
fn output_delimiter_nul() {
96112
new_ucmd!()
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
a
2+
--helpb
3+
--help--helpz
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
a
2+
-1b
3+
-1-1z

0 commit comments

Comments
 (0)