1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-04-21 11:16:16 +02:00

date: --debug: diagnose discarded -d or -s options

* src/date.c: (main): Track and diagnose whether any
-d or -s options are dropped, as users may think
multiple options are supported, given they can be relative.
* tests/misc/date-debug.sh: Add a test case.
* NEWS: Mention the improvement.
This commit is contained in:
Pádraig Brady
2022-07-24 19:24:18 +01:00
parent 96c1499413
commit 854e035121
3 changed files with 27 additions and 0 deletions

View File

@@ -298,4 +298,14 @@ sed '1s/(Y-M-D) [0-9][0-9][0-9][0-9]-/(Y-M-D) XXXX-/' out9_t > out9 \
compare exp9 out9 || fail=1
# Diagnose discarded -d arguments
echo 'date: only using last of multiple -d options' > exp10 \
|| framework_failure_
cat exp9 >> exp10 || framework_failure_
date -u --debug -d 'discard' -d 'Apr 11 22:59:00 2011' > out10_t 2>&1 || fail=1
sed '2s/(Y-M-D) [0-9][0-9][0-9][0-9]-/(Y-M-D) XXXX-/' out10_t >> out10 \
|| framework_failure_
compare exp10 out10 || fail=1
Exit $fail