Skip to content

tests: set date spec in basic.t#286

Merged
Davis-A merged 1 commit intofastmail:mainfrom
Davis-A:tests-fix-basic.t
Mar 23, 2026
Merged

tests: set date spec in basic.t#286
Davis-A merged 1 commit intofastmail:mainfrom
Davis-A:tests-fix-basic.t

Conversation

@Davis-A
Copy link
Copy Markdown
Member

@Davis-A Davis-A commented Mar 20, 2026

This wasn't matching the output of the date command on my laptop, or on an inabox. Make the regex a bit looser

edit: see below

@Davis-A Davis-A requested a review from rjbs March 20, 2026 09:22
Pass `date` a format for the date output.

To check we can run a process we fork out and run `date` and check the
output matches a regex.  The regex expects something like this:
'Mon Mar 23 09:30:57 UTC 2026'.

But the format date prints by default depends on the LANG environment
variable.

And when you work with a bunch of Australian's some are going
to have LANG=en_AU.UTF-8 which produces a date like this:
'Mon 23 Mar 2026 20:30:07 AEDT'
@Davis-A Davis-A force-pushed the tests-fix-basic.t branch from 999812a to b84136c Compare March 23, 2026 09:40
@Davis-A
Copy link
Copy Markdown
Member Author

Davis-A commented Mar 23, 2026

Well figured that out, date output format depends on the LANG environment variable. Both my laptop and fminabox are set to en_AU.UTF-8 (i'm honestly not sure what sets inabox to that or whether i'm doing it with dotfiles somewhere and forgot).

Anyway, TIL:

bash-3.2$ echo $LANG
en_AU.UTF-8
bash-3.2$ date
Mon 23 Mar 2026 20:36:07 AEDT
bash-3.2$ LANG=en_US.UTF-8
bash-3.2$ date
Mon Mar 23 20:36:11 AEDT 2026

@Davis-A Davis-A changed the title tests: update the regex for the run_process subtest tests: set date spec in basic.t Mar 23, 2026
: die "This test requires either /bin/date or /usr/bin/date exist.";

my $f = $hub->run_process([ $date ]);
my $f = $hub->run_process([ $date, '+%a %b %e %I:%M:%S %p %Z %Y']);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

%s would be even easier to know it wasn't affected by env. ;-)

@Davis-A Davis-A merged commit 2c1fbc4 into fastmail:main Mar 23, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants