Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/uu/unexpand/src/unexpand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ fn parse_tab_num(word: &str, allow_zero: bool) -> Result<usize, ParseError> {
}

fn parse_tabstops(s: &str) -> Result<TabConfig, ParseError> {
let words = s.split(',');
// GNU accepts both a comma and a blank as tab-list separators.
let words = s.split([' ', ',']);

let mut nums = Vec::new();
let mut increment_size: Option<usize> = None;
Expand Down
10 changes: 10 additions & 0 deletions tests/by-util/test_unexpand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,16 @@ fn test_comma_separated_tabs_shortcut() {
.stdout_is("a\tb\tc");
}

#[test]
fn test_space_separated_tabs() {
// GNU accepts a blank as a tab-list separator, just like a comma.
new_ucmd!()
.args(&["-a", "-t", "3 9"])
.pipe_in("a b c")
.succeeds()
.stdout_is("a\tb\tc");
}

#[test]
fn test_tabs_cannot_be_zero() {
new_ucmd!()
Expand Down
Loading