tests: nl: ensure nl accepts negative -v and -i values

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

* tests/nl/nl.sh: Add test cases.

Link: https://github.com/coreutils/coreutils/pull/426
This commit is contained in:
Sylvestre Ledru authored and Pádraig Brady committed 2026-11-07 12:35:10 +00:00
1 parent c1265262f9
commit 5d793a1521
1 file changed
+9
+9
View File
@@ -142,4 +142,13 @@ printf ' 1\ta\n \n 2\tb\n \n 3\tc\n' >exp \
compare exp out || fail=1
compare /dev/null err || fail=1
# Negative -v and -i values are accepted.
printf 'a\nb\n' > inp || framework_failure_
nl -v -1 inp > out || fail=1
printf ' -1\ta\n 0\tb\n' > exp || framework_failure_
compare exp out || fail=1
nl -v 5 -i -1 inp > out || fail=1
printf ' 5\ta\n 4\tb\n' > exp || framework_failure_
compare exp out || fail=1
Exit $fail