tests: expand, unexpand: ensure a bare '-' is treated as standard input

Reported at https://github.com/uutils/coreutils/issues/15658

* tests/expand/expand.pl: Add test case.
* tests/unexpand/unexpand.pl: Add test cases.

Link: https://github.com/coreutils/coreutils/pull/416
This commit is contained in:
Sylvestre Ledru authored and Pádraig Brady committed 2026-11-07 12:35:10 +00:00
1 parent bea11752b3
commit 9233e94688
2 files changed
+11

No files matched your search

+4
View File
@@ -184,6 +184,10 @@ my @Tests =
{ERR => "$prog: '/' specifier only allowed with the last value\n"}],
['e7', '--tabs=3/', {IN=>''}, {OUT=>''}, {EXIT=>1},
{ERR => "$prog: '/' specifier not at start of number: '/'\n"}],
# A bare '-' is standard input.
['stdin-dash', '-', {IN_PIPE=>"stdin\n"}, {IN=>{f=>"file\n"}},
{OUT=>"stdin\nfile\n"}],
);
my $save_temps = $ENV{DEBUG};
+7
View File
@@ -136,6 +136,13 @@ my @Tests =
['ts1', '-t8,9', {IN=>"x\t \t y\n"}, {OUT=>"x\t\t\t y\n"}],
# There is no ambiguity here. This should always be the output.
['ts2', '-t5,8', {IN=>"x\t \t y\n"}, {OUT=>"x\t\t y\n"}],
# A bare '-' is standard input, not an obsolete -N tab stop list.
['stdin-dash', '-', {IN_PIPE=>"stdin\n"}, {IN=>{f=>"file\n"}},
{OUT=>"stdin\nfile\n"}],
['stdin-dash-t', '-t 3 -', {IN_PIPE=>"a b\n"}, {OUT=>"a\tb\n"}],
['stdin-dash-f', '--first-only -', {IN_PIPE=>" A B\n"},
{OUT=>"\tA B\n"}],
);
my $save_temps = $ENV{DEBUG};