From 43df058b91e94c096b642291737daea1d2868cdb Mon Sep 17 00:00:00 2001 From: KOBAYASHI Takashi Date: Sun, 1 May 2016 13:47:25 +0100 Subject: nl: reset numbering for each section * NEWS: Mention the bug fix. * src/nl.c (proc_body, proc_footer): Reset numbering here too. * doc/coreutils.texi (nl invocation): Adjust for behavior change. * tests/misc/nl.sh: Add a test case. --- tests/misc/nl.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests') diff --git a/tests/misc/nl.sh b/tests/misc/nl.sh index e111d7a01..826894af2 100755 --- a/tests/misc/nl.sh +++ b/tests/misc/nl.sh @@ -37,7 +37,22 @@ cat <<\EOF > exp 1^Ia$ $ EOF +compare exp out || fail=1 +# Ensure numbering reset at each delimiter. +# coreutils <= v8.25 only reset at a page header. +printf '%s\n' '\:\:\:' a '\:\:' b '\:' c > in.txt || framework_failure_ +nl -ha -fa in.txt > out.tmp || fail=1 +nl -p -ha -fa in.txt >> out.tmp || fail=1 +sed '/^$/d' < out.tmp > out || framework_failure_ +cat <<\EOF > exp + 1 a + 1 b + 1 c + 1 a + 2 b + 3 c +EOF compare exp out || fail=1 Exit $fail -- cgit v1.2.3-70-g09d2