On 24/12/2025 04:19, Collin Funk wrote:
* tests/date/date-locale-hour.sh: Test that the default format of all
supported locales is the same as 'locale date_fmt'.
---
tests/date/date-locale-hour.sh | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tests/date/date-locale-hour.sh b/tests/date/date-locale-hour.sh
index 409091080..205e8afa3 100755
--- a/tests/date/date-locale-hour.sh
+++ b/tests/date/date-locale-hour.sh
@@ -56,5 +56,13 @@ for loc in "$LOCALE_FR_UTF8" 'en_US.UTF-8'; do
esac
done
+# Make sure 'date' can use the format string given by 'locale date_fmt'
+# and that it uses it by default when no format string is given.
+for locale in $(locale -a); do
+ export LC_ALL=$locale
+ date -d '2025-10-11T13:00' +"$(locale date_fmt)" > $locale.exp || fail=1
+ date -d '2025-10-11T13:00' > $locale.out || fail=1
+ compare $locale.exp $locale.out || fail=1
+done
It might be a little overkill?
$ locale -a | wc -l 890
Maybe `locale -a | shuf -n10`
Also this outputs nothing:
$ date -d '2025-10-11T13:00' +
I.e. we'd want to verify that `locale date_fmt` actually returns something,
as otherwise there would be a mismatch.
cheers,
Padraig