diff --git a/src/uu/comm/src/comm.rs b/src/uu/comm/src/comm.rs index 78ef4e5c2..24d089df4 100644 --- a/src/uu/comm/src/comm.rs +++ b/src/uu/comm/src/comm.rs @@ -33,7 +33,10 @@ mod options { fn mkdelim(col: usize, opts: &ArgMatches) -> String { let mut s = String::new(); - let delim = opts.value_of(options::DELIMITER).unwrap(); + let delim = match opts.value_of(options::DELIMITER).unwrap() { + "" => "\0", + delim => delim, + }; if col > 1 && !opts.is_present(options::COLUMN_1) { s.push_str(delim.as_ref()); diff --git a/tests/by-util/test_comm.rs b/tests/by-util/test_comm.rs index ebfc9c6f9..b470f708b 100644 --- a/tests/by-util/test_comm.rs +++ b/tests/by-util/test_comm.rs @@ -59,13 +59,12 @@ fn output_delimiter() { .stdout_only_fixture("ab_delimiter_word.expected"); } -#[cfg_attr(not(feature = "test_unimplemented"), ignore)] #[test] -fn output_delimiter_require_arg() { +fn output_delimiter_nul() { new_ucmd!() .args(&["--output-delimiter=", "a", "b"]) - .fails() - .stderr_only("error to be defined"); + .succeeds() + .stdout_only_fixture("ab_delimiter_nul.expected"); } // even though (info) documentation suggests this is an option diff --git a/tests/fixtures/comm/ab_delimiter_nul.expected b/tests/fixtures/comm/ab_delimiter_nul.expected new file mode 100644 index 000000000..e56ec5cd7 Binary files /dev/null and b/tests/fixtures/comm/ab_delimiter_nul.expected differ