summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKOBAYASHI Takashi <a1415tk@aiit.ac.jp>2016-05-01 13:47:25 +0100
committerPádraig Brady <P@draigBrady.com>2016-05-14 12:41:43 +0100
commit43df058b91e94c096b642291737daea1d2868cdb (patch)
tree6834af8ebfe36a8f4b0ad5b5ae8ff6e4cfeaa281 /tests
parent99dd47ec86b508410df64bef2b7bf4922215cf5b (diff)
downloadcoreutils-43df058b91e94c096b642291737daea1d2868cdb.tar.xz
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.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/misc/nl.sh15
1 files changed, 15 insertions, 0 deletions
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