coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tests: date: improve locale tests


From: Collin Funk
Subject: Re: [PATCH] tests: date: improve locale tests
Date: Wed, 24 Dec 2025 18:50:31 -0800
User-agent: Gnus/5.13 (Gnus v5.13)

PƔdraig Brady <P@draigBrady.com> writes:

>> +# 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`

It was fast on my system, at least.

It is also good at testing strftime because I don't think we have
coverage for the 'E' and 'O' flags.

But testing 10 locales should be enough, so that is fine with me.

> 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.

I would hope that is never the case. But the systems locales are out of
our control, so we can add that check.

I pushed the attached v2 patch, which also addresses Grisha's comments.

Thanks both for the review.

Collin

Attachment: v2-0001-tests-date-improve-locale-tests.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]