summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2022-07-24 19:24:18 +0100
committerPádraig Brady <P@draigBrady.com>2022-07-24 20:40:34 +0100
commit854e0351216869b8e79391e08b156127d1508beb (patch)
treec25409b8cf35b759dd43e2a837b16f3c3a83d41c /tests
parent96c149941357186abcbd8da914544a7867cab01e (diff)
downloadcoreutils-854e0351216869b8e79391e08b156127d1508beb.tar.gz
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.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/misc/date-debug.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/misc/date-debug.sh b/tests/misc/date-debug.sh
index 0b5217611..5c38dee41 100755
--- a/tests/misc/date-debug.sh
+++ b/tests/misc/date-debug.sh
@@ -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