pg: Add date type & httpdate tests
...I was hoping not to have to implement the date type, because date conversions suck, but it turns out manned.org actually needs it. (Only to then convert it into a Unix timestamp again, hmm, maybe this string conversion isn't useful at all?)
This commit is contained in:
parent
8595c4ba64
commit
fbbaa23842
4 changed files with 56 additions and 2 deletions
13
t/httpdate.t
Normal file
13
t/httpdate.t
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
use v5.38;
|
||||
use Test::More;
|
||||
use FU::Util 'httpdate_format', 'httpdate_parse';
|
||||
|
||||
is httpdate_format(0), 'Thu, 01 Jan 1970 00:00:00 GMT';
|
||||
is httpdate_format(1740325942), 'Sun, 23 Feb 2025 15:52:22 GMT';
|
||||
|
||||
is httpdate_parse('Thu, 01 Jan 1970 00:00:00 GMT'), 0;
|
||||
is httpdate_parse('Sun, 23 Feb 2025 15:52:22 GMT'), 1740325942;
|
||||
is httpdate_parse('Sub, 23 Feb 2025 15:52:22 GMT'), undef;
|
||||
is httpdate_parse('Sun, 3 Feb 2025 15:52:22 GMT'), undef;
|
||||
|
||||
done_testing;
|
||||
|
|
@ -115,6 +115,14 @@ v timestamptz => 1740133814.705915, undef, '2025-02-21 10:30:14.705915+00';
|
|||
v timestamp => 0, undef, '1970-01-01 00:00:00';
|
||||
v timestamp => 1740133814.705915, undef, '2025-02-21 10:30:14.705915';
|
||||
|
||||
v date => '1970-01-01';
|
||||
v date => '1999-01-08';
|
||||
v date => '2025-02-24';
|
||||
f date => '';
|
||||
f date => '2025-';
|
||||
f date => '2025-02-';
|
||||
f date => '1999-Jan-08';
|
||||
|
||||
v 'int[]', [], undef, '{}';
|
||||
v 'int[]', [1], undef, '{1}';
|
||||
v 'int[]', [1,-3,undef,3], undef, '{1,-3,NULL,3}';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue