From: Sylvestre Ledru <[email protected]> * 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
