Bugzilla – Attachment 129468 Details for
Bug 29718
DateTime - our 'iso' is not ISO 8601
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29718: Unit tests
Bug-29718-Unit-tests.patch (text/plain), 1.95 KB, created by
Marcel de Rooy
on 2022-01-14 09:37:14 UTC
(
hide
)
Description:
Bug 29718: Unit tests
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2022-01-14 09:37:14 UTC
Size:
1.95 KB
patch
obsolete
>From dcfe93ac3f26e2b2dd1040c25a60a99b843119d6 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 21 Dec 2021 13:49:29 +0000 >Subject: [PATCH] Bug 29718: Unit tests >Content-Type: text/plain; charset=utf-8 > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/DateUtils.t | 29 +++++++++++++++++++++++++++++ > 1 file changed, 29 insertions(+) > >diff --git a/t/DateUtils.t b/t/DateUtils.t >index 274c3f3975..d466a4a013 100755 >--- a/t/DateUtils.t >+++ b/t/DateUtils.t >@@ -142,6 +142,35 @@ eval { > }; > like( $@, qr/.*does not match the date format \(rfc3339\).*/, 'dt_from_string should die when passed a bad date string' ); > >+# ISO string tests >+subtest 'dt_from_string - iso format' => sub { >+ plan tests => 6; >+ >+ # Dateonly >+ my $dt_iso = dt_from_string( '2012-01-01', 'iso' ); >+ cmp_ok( $dt_iso->epoch(), 'eq', '1325376000', 'dt_from_string handles dateonly string' ); >+ >+ eval { >+ $dt_iso = dt_from_string( '2012-01-32', 'iso' ); >+ }; >+ like( $@, qr/^Validation failed/, 'Fail on invalid dateonly string'); >+ >+ # Datetime >+ $dt_iso = dt_from_string( '2012-01-01T23:59:59', 'iso' ); >+ cmp_ok( $dt_iso->epoch(), 'eq', '1325455199', 'dt_from_string with no offset assumes "local"' ); >+ >+ # Datetime with timezone >+ $dt_iso = dt_from_string( '2012-01-01T23:59:59Z', 'iso' ); >+ cmp_ok( $dt_iso->epoch(), 'eq', '1325455199', 'dt_from_string with UTC prescribed as Z' ); >+ >+ $dt_iso = dt_from_string( '2012-01-01T23:59:59+02:00', 'iso' ); >+ cmp_ok( $dt_iso->epoch(), 'eq', '1325455199', 'dt_from_string with offset' ); >+ >+ $dt_iso = dt_from_string( '2012-01-01T23:59:59+02:00', 'iso' ); >+ cmp_ok( $dt_iso->epoch(), 'eq', '1325455199', 'dt_from_string handles an offset' ); >+ >+}; >+ > # Return undef if passed mysql 0 dates > $dt0 = dt_from_string( '0000-00-00', 'iso' ); > is( $dt0, undef, "undefined returned for 0 iso date" ); >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29718
:
128631
|
128653
|
128654
|
128658
|
128840
|
129372
|
129385
|
129386
|
129387
|
129388
|
129389
|
129390
|
129465
|
129466
|
129467
| 129468 |
129469
|
129470
|
129471