[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 09/10] tests: nl: check option values starting with a hyphen
|
From: |
Pádraig Brady |
|
Subject: |
[PATCH 09/10] tests: nl: check option values starting with a hyphen |
|
Date: |
Sun, 15 Nov 2026 16:20:12 +0000 |
From: Sylvestre Ledru <sylvestre@debian.org>
* tests/nl/nl.sh: Ensure -s, --number-separator and -d accept
values starting with '-', and that -b, -h, -f and -n diagnose
such values as invalid values rather than options.
https://github.com/uutils/coreutils/pull/16376
Link: https://github.com/coreutils/coreutils/pull/468
---
tests/nl/nl.sh | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/tests/nl/nl.sh b/tests/nl/nl.sh
index d4354d708..df62c705c 100755
--- a/tests/nl/nl.sh
+++ b/tests/nl/nl.sh
@@ -151,4 +151,19 @@ nl -v 5 -i -1 inp > out || fail=1
printf ' 5\ta\n 4\tb\n' > exp || framework_failure_
compare exp out || fail=1
+# Option values may start with a hyphen.
+echo a | nl -s -z > out || fail=1
+echo a | nl -s -- >> out || fail=1
+echo a | nl --number-separator -x >> out || fail=1
+printf 'a\n-z\nb\n' | nl -d -z >> out || fail=1
+printf 'a\n----\nb\n' | nl -d -- >> out || fail=1
+printf ' 1-za\n 1--a\n 1-xa\n 1\ta\n\n b\n' > exp \
+ || framework_failure_
+printf ' 1\ta\n\n 1\tb\n' >> exp || framework_failure_
+compare exp out || fail=1
+for opt in -b -h -f -n; do
+ returns_ 1 nl $opt -x </dev/null 2>err || fail=1
+ grep -F -- "'-x'" err || { cat err; fail=1; }
+done
+
Exit $fail
--
2.56.0
- [PATCH 01/10] tests: fmt: add -t tests with a one-line paragraph, Pádraig Brady, 2026/11/15
- [PATCH 06/10] tests: join: check -o fields after the file operands, Pádraig Brady, 2026/11/15
- [PATCH 07/10] tests: seq: check -w with scientific notation, Pádraig Brady, 2026/11/15
- [PATCH 04/10] tests: stat: check the 0 flag with a precision, Pádraig Brady, 2026/11/15
- [PATCH 05/10] tests: stat: check an empty --format or --printf, Pádraig Brady, 2026/11/15
- [PATCH 08/10] tests: expand: check the column is kept across files and buffers, Pádraig Brady, 2026/11/15
- [PATCH 10/10] tests: stat: check %#a adds a single leading 0, Pádraig Brady, 2026/11/15
- [PATCH 02/10] tests: dircolors: check TERM filtering of the built-in database, Pádraig Brady, 2026/11/15
- [PATCH 03/10] tests: pr: check -m with a separator and a page width, Pádraig Brady, 2026/11/15
- [PATCH 09/10] tests: nl: check option values starting with a hyphen,
Pádraig Brady <=