From: Sylvestre Ledru <[email protected]> * tests/pr/pr-tests.pl (merge-sep, merge-sep-w, merge-Sep-w) (merge-sep-W): New tests, ensuring -s joins merged lines unpadded unless a width is given, -S keeps the padding, and -W wins over -w.
https://github.com/uutils/coreutils/pull/16236 Link: https://github.com/coreutils/coreutils/pull/461 --- tests/pr/pr-tests.pl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/pr/pr-tests.pl b/tests/pr/pr-tests.pl index 812e215ac..c867071a1 100755 --- a/tests/pr/pr-tests.pl +++ b/tests/pr/pr-tests.pl @@ -491,6 +491,22 @@ push @Tests, {IN=>{2=>"m\tn\to\n"}}, {OUT=>join("\t", qw(a b c m n o)) . "\n"} ]; +# With -m, -s joins the lines unpadded, unless a width is given. +# -S keeps the padding, and -W wins over -w. +push @Tests, + ['merge-sep', '-m -t -s,', + {IN=>{1=>"line one\n2\n"}}, {IN=>{2=>"x\ny\n"}}, + {OUT=>"line one,x\n2,y\n"} ], + ['merge-sep-w', '-m -t -s, -w 10', + {IN=>{1=>"line one\n2\n"}}, {IN=>{2=>"x\ny\n"}}, + {OUT=>"line,x\n2 ,y\n"} ], + ['merge-Sep-w', '-m -t -S, -w 10', + {IN=>{1=>"line one\n2\n"}}, {IN=>{2=>"x\ny\n"}}, + {OUT=>"line,x\n2 ,y\n"} ], + ['merge-sep-W', '-m -t -s, -W 10 -w 20', + {IN=>{1=>"line one\n2\n"}}, {IN=>{2=>"x\ny\n"}}, + {OUT=>"line,x\n2 ,y\n"} ]; + # This resulted in reading invalid memory before coreutils-8.26 push @Tests, ['asan1', "-m -S'\t\t\t' -t", -- 2.56.0
