From bc94551f63cfc4c05a56628dfcb386707d9e98cb Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Sat, 26 Sep 2015 14:22:26 +0100 Subject: head,tail: add the -z,--zero-terminated option * doc/coreutils.texi: Reference the option description. * src/head.c: Parameterize the delimiter character. * src/tail.c: Likewise. * tests/misc/head.pl: Add test case. * tests/misc/tail.pl: Likewise. * NEWS: Mention the new feature. --- tests/misc/head.pl | 4 ++++ tests/misc/tail.pl | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'tests') diff --git a/tests/misc/head.pl b/tests/misc/head.pl index 78644f2a5..1f565cf16 100755 --- a/tests/misc/head.pl +++ b/tests/misc/head.pl @@ -72,6 +72,10 @@ my @Tests = ['no-oct-2', '-010', {IN=>"\n"x12}, {OUT=>"\n"x10}], ['no-oct-3', '-n 08', {IN=>"\n"x12}, {OUT=>"\n"x8}], ['no-oct-4', '-c 08', {IN=>"\n"x12}, {OUT=>"\n"x8}], + + # --zero-terminated + ['zero-1', '-z -n 1', {IN=>"x\0y"}, {OUT=>"x\0"}], + ['zero-2', '-z -n 2', {IN=>"x\0y"}, {OUT=>"x\0y"}], ); @Tests = triple_test \@Tests; diff --git a/tests/misc/tail.pl b/tests/misc/tail.pl index c23102fe8..0d9bc4834 100755 --- a/tests/misc/tail.pl +++ b/tests/misc/tail.pl @@ -101,6 +101,10 @@ my @tv = ( # With textutils-1.22, this failed. ['f-pipe-1', '-f -n 1', "a\nb\n", "b\n", 0], + +# --zero-terminated +['zero-1', '-z -n 1', "x\0y", "y", 0], +['zero-2', '-z -n 2', "x\0y", "x\0y", 0], ); my @Tests; -- cgit v1.2.3-70-g09d2