From 9abc63e32fa2ffdceb7bbe9bf8f7cc9aa6d23c98 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 3 Nov 2021 12:14:50 +0000 Subject: [PATCH] Bug 29403: Unit tests Content-Type: text/plain; charset=utf-8 Add a unit test for proper iso date handling Signed-off-by: Tomas Cohen Arazi Signed-off-by: Jonathan Druart Signed-off-by: Marcel de Rooy --- t/DateUtils.t | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/t/DateUtils.t b/t/DateUtils.t index 9e366994d5..3aae15162e 100755 --- a/t/DateUtils.t +++ b/t/DateUtils.t @@ -4,7 +4,7 @@ use DateTime::TimeZone; use C4::Context; -use Test::More tests => 80; +use Test::More tests => 81; use Test::MockModule; use Test::Warn; @@ -140,7 +140,12 @@ cmp_ok( $dt0->epoch(), 'eq', '1325455199', 'dt_from_string handles seconds with eval { $dt0 = dt_from_string( '2012-01-01T23:59:59.999Z+02:00', 'rfc3339' ); }; -like( $@, qr/.*does not match the date format \(rfc3339\).*/, 'dt_from_string should die when passed a bad date string' ); +like( $@, qr/.*does not match the date format \(rfc3339\).*/, 'dt_from_string should die when passed a bad rfc3339 date string' ); + +eval { + $dt0 = dt_from_string('2021-11-03T10:16:59+00:00', 'iso'); +}; +like( $@, qr/.*does not match the date format \(iso\).*/, 'dt_from_string should die when passed a bad iso date string' ); # ISO string tests subtest 'dt_from_string - iso format' => sub { -- 2.20.1